-
Notifications
You must be signed in to change notification settings - Fork 4
Fix/cachix pin no response #950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
automergerpr-permission-manager
merged 2 commits into
master
from
fix/cachix-pin-no-response
Feb 27, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/usr/bin/env bash | ||
| set -xeuo pipefail | ||
|
|
||
| # Kup relies on cachix registry k-framework-binary. | ||
| CACHE="k-framework-binary" | ||
| OWNER_REPO="$(git remote get-url origin | sed -E 's#(git@github.com:|https://github.com/)##; s#\.git$##')" | ||
| REV="$(git rev-parse HEAD)" | ||
| # Get the output of the nix build for kmir. | ||
| OUT="$(nix build --no-link --json ".#kmir" | jq -r '.[0].outputs.out')" | ||
| KEY="github:${OWNER_REPO}/${REV}#kmir" | ||
|
|
||
| SUMMARY="${GITHUB_STEP_SUMMARY:-/dev/stdout}" | ||
|
|
||
| { | ||
| echo "## Cachix Publish Summary" | ||
| echo "CACHE: $CACHE" | ||
| echo "OUT: $OUT" | ||
| echo "KEY: $KEY" | ||
| } >> "$SUMMARY" | ||
|
|
||
| # Verify push + pin together. Both can become visible with some delay. | ||
| HASH="$(basename "$OUT" | cut -d- -f1)" | ||
| PUSH_NARINFO_URL="https://${CACHE}.cachix.org/${HASH}.narinfo" | ||
| PIN_API_URL="https://app.cachix.org/api/v1/cache/${CACHE}/pin" | ||
| PIN_VISIBILITY_TIMEOUT_SECONDS=120 # 2 minutes | ||
| PIN_VISIBILITY_INTERVAL_SECONDS=5 # 5 seconds | ||
| PIN_VISIBILITY_ATTEMPTS=$((PIN_VISIBILITY_TIMEOUT_SECONDS / PIN_VISIBILITY_INTERVAL_SECONDS)) | ||
| for i in $(seq 1 "$PIN_VISIBILITY_ATTEMPTS"); do | ||
| PUSH_STATUS="$(curl -sS -o /dev/null -w '%{http_code}' "$PUSH_NARINFO_URL")" || PUSH_STATUS="000" | ||
| if curl -fsSL "$PIN_API_URL" | jq -e --arg k "$KEY" 'any(.[]; .name == $k)' > /dev/null; then | ||
| PIN_STATUS="pin-ok" | ||
| else | ||
| PIN_STATUS="pin-missing" | ||
| fi | ||
|
|
||
| echo "push-http: ${PUSH_STATUS}" >> "$SUMMARY" | ||
| echo "pin-status: ${PIN_STATUS}" >> "$SUMMARY" | ||
|
|
||
| if [ "$PUSH_STATUS" = "200" ] && [ "$PIN_STATUS" = "pin-ok" ]; then | ||
| echo "cachix-status: push-and-pin-ok" >> "$SUMMARY" | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "cachix-check-attempt-${i}: not-ready, retrying in ${PIN_VISIBILITY_INTERVAL_SECONDS}s" >> "$SUMMARY" | ||
| sleep "$PIN_VISIBILITY_INTERVAL_SECONDS" | ||
| done | ||
|
|
||
| echo "cachix-status: push-or-pin-missing-after-${PIN_VISIBILITY_TIMEOUT_SECONDS}s" >> "$SUMMARY" | ||
| exit 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: 'Test Cachix Pin' | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| ref: | ||
| description: 'Git ref (tag or SHA) of an existing release to verify' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| verify-cachix-pin: | ||
| name: 'Verify Cachix Pin' | ||
| runs-on: [self-hosted, linux, normal] | ||
| steps: | ||
| - name: 'Check out code' | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.ref }} | ||
|
|
||
| - name: 'Verify cachix publish and pin' | ||
| uses: workflow/nix-shell-action@v3 | ||
| env: | ||
| CACHIX_AUTH_TOKEN: '${{ secrets.CACHIX_PRIVATE_KFB_TOKEN }}' | ||
| GC_DONT_GC: '1' | ||
| with: | ||
| packages: jq | ||
| script: bash .github/scripts/check-cachix-pin.sh |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that if
PIN_STATUS="pin-ok"on a loop but this continues it would always update to"pin-ok"for iterations from there on, but I want to make this comment in case I am wrong or to add some scrutiny to that belief.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it would continue to report "pin-ok" until both push and pin are "200" and "pin-ok" and then exit or fail out at the end of the loop count.
Generally the order "should" be, we see push status returns 200, and then "pin-ok" shows up within a few minutes.