Repository navigation
feat: stacks, the container stack, and quay.io/crunchtools/sdlc #59
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
Changes from all commits
9be1348
0323fca
50416d5
36a89f9
9e982f1
08ed876
eccf58d
06bba33
daa02d5
d820756
aa57a90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| # Build, test and publish quay.io/crunchtools/python-sdlc. | ||
| # Build, test and publish quay.io/crunchtools/python-sdlc, and the same digest | ||
| # as quay.io/crunchtools/sdlc, the fleet-wide name it is becoming. | ||
| # | ||
| # The shape is the Container Image profile's, and it is the same shape trentina | ||
| # arrived at the hard way in #689: the build pushes ONLY the commit SHA tag, the | ||
|
|
@@ -54,6 +55,11 @@ permissions: {} | |
|
|
||
| env: | ||
| QUAY: quay.io/crunchtools/python-sdlc | ||
| # The fleet-wide name for the same image: one digest, two repositories, the | ||
| # same tags on both, until every consumer has moved and python-sdlc retires. | ||
| # It is never built or pushed separately -- it is a COPY of the digest pushed | ||
| # above, so the two names cannot disagree about what they hold. | ||
| SDLC: quay.io/crunchtools/sdlc | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
@@ -72,7 +78,7 @@ jobs: | |
| digest: ${{ steps.push.outputs.digest || steps.resolve.outputs.digest }} | ||
| ref: ${{ steps.push.outputs.ref || steps.resolve.outputs.ref }} | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
|
|
@@ -81,9 +87,11 @@ jobs: | |
| run: | | ||
| set -eu | ||
| podman run --rm -v "$PWD:/mnt:ro,z" -w /mnt \ | ||
| docker.io/koalaman/shellcheck:v0.11.0 bin/sdlc tests/contract.sh \ | ||
| tests/test_host_contract.sh scripts/release-version.sh | ||
| docker.io/koalaman/shellcheck:v0.11.0@sha256:61862eba1fcf09a484ebcc6feea46f1782532571a34ed51fedf90dd25f925a8d bin/sdlc tests/contract.sh \ | ||
| tests/test_host_contract.sh tests/test_container_stack.sh scripts/release-version.sh \ | ||
| scripts/revision-of.sh tests/test_revision_of.sh | ||
| tests/test_host_contract.sh | ||
| tests/test_revision_of.sh | ||
| tests/test_release_version.py | ||
|
|
||
| - name: Build | ||
|
|
@@ -124,6 +132,12 @@ jobs: | |
| "localhost/python-sdlc:$GITHUB_SHA" "$t" | ||
| done | ||
|
|
||
| # The container stack through the real launcher and a real podman: the | ||
| # image mount grype scans is something only podman can prove. | ||
| - name: Container stack end to end | ||
| if: env.IS_TAG != 'true' | ||
| run: tests/test_container_stack.sh "localhost/python-sdlc:$GITHUB_SHA" | ||
|
|
||
| - name: Log in to Quay | ||
| if: github.event_name != 'pull_request' | ||
| env: | ||
|
|
@@ -139,9 +153,15 @@ jobs: | |
| podman push "localhost/python-sdlc:$GITHUB_SHA" "$QUAY:$GITHUB_SHA" | ||
| digest=$(skopeo inspect --format '{{.Digest}}' "docker://$QUAY:$GITHUB_SHA") | ||
| [ -n "$digest" ] || { echo "the registry reported no digest" >&2; exit 1; } | ||
| # The fleet name gets the SAME manifest, copied rather than pushed a | ||
| # second time: a second podman push recompresses the layers and can | ||
| # produce a different digest, and then the two names hold two images. | ||
| skopeo copy --all --preserve-digests "docker://$QUAY@$digest" "docker://$SDLC:$GITHUB_SHA" | ||
| got=$(skopeo inspect --format '{{.Digest}}' "docker://$SDLC:$GITHUB_SHA") | ||
| [ "$got" = "$digest" ] || { echo "$SDLC:$GITHUB_SHA is $got, not $digest" >&2; exit 1; } | ||
| echo "digest=$digest" >> "$GITHUB_OUTPUT" | ||
| echo "ref=$QUAY@$digest" >> "$GITHUB_OUTPUT" | ||
| echo "pushed $QUAY@$digest" | ||
| echo "pushed $QUAY@$digest and $SDLC@$digest" | ||
|
|
||
| # The tag path, in place of everything above. Nothing is built and nothing | ||
| # is pushed: this reads the digest the main-branch run of this same commit | ||
|
|
@@ -185,7 +205,7 @@ jobs: | |
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Contract test against the pushed digest | ||
|
|
@@ -211,7 +231,7 @@ jobs: | |
| steps: | ||
| # Full history: the backwards-move guard below asks git whether the | ||
| # currently published commit already contains this one. | ||
| - uses: actions/checkout@v7 | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
|
|
@@ -262,22 +282,30 @@ jobs: | |
| # RT#1550): --preserve-digests refuses a copy that would change the | ||
| # manifest, and the read-back fails the job if the tag resolves to | ||
| # anything but the digest that was tested. | ||
| # | ||
| # Every tag moves on BOTH names, python-sdlc and sdlc, to the same | ||
| # digest, and the guard reads both: either one ahead of this commit | ||
| # refuses the whole promotion rather than leaving them split. | ||
| want=${REF#*@} | ||
| promote() { | ||
| skopeo copy --all --preserve-digests "docker://$REF" "docker://$QUAY:$1" | ||
| got=$(skopeo inspect --format '{{.Digest}}' "docker://$QUAY:$1") | ||
| [ "$got" = "$want" ] || { echo ":$1 resolves to $got, not the tested $want" >&2; exit 1; } | ||
| for repo in "$QUAY" "$SDLC"; do | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MEDIUM (Bug Hunter): Promotion updates the two repositories sequentially. If copying or verifying the second repository fails after the first succeeds, the workflow exits with the tags pointing at different digests, contrary to the stated same-digest promotion behavior. Suggestion: Handle partial promotion explicitly: on failure, retry or reconcile both repositories to the tested digest, and report the partial state so it cannot be mistaken for a completed promotion. Evidence:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a bug: no registry can move tags on two repositories atomically. What matters is that a split is loud and self-healing, and it is. Any copy or read-back that fails exits non-zero, so the job goes red. A rerun converges because |
||
| skopeo copy --all --preserve-digests "docker://$REF" "docker://$repo:$1" | ||
| got=$(skopeo inspect --format '{{.Digest}}' "docker://$repo:$1") | ||
| [ "$got" = "$want" ] || { echo "$repo:$1 resolves to $got, not the tested $want" >&2; exit 1; } | ||
| done | ||
| } | ||
| if [ -n "$floating" ]; then | ||
| current=$(skopeo inspect --format \ | ||
| '{{ index .Labels "org.opencontainers.image.revision" }}' \ | ||
| "docker://$QUAY:$floating" 2>/dev/null || true) | ||
| if [ -n "${current:-}" ] && [ "$current" != "$GITHUB_SHA" ]; then | ||
| if git merge-base --is-ancestor "$GITHUB_SHA" "$current" 2>/dev/null; then | ||
| echo "refusing: :$floating is $current, which already contains $GITHUB_SHA" >&2 | ||
| exit 1 | ||
| for repo in "$QUAY" "$SDLC"; do | ||
| # Fails closed: only an absent tag reads as empty | ||
| # (scripts/revision-of.sh, tests/test_revision_of.sh). | ||
| current=$(scripts/revision-of.sh "$repo:$floating") | ||
| if [ -n "${current:-}" ] && [ "$current" != "$GITHUB_SHA" ]; then | ||
| if git merge-base --is-ancestor "$GITHUB_SHA" "$current" 2>/dev/null; then | ||
| echo "refusing: $repo:$floating is $current, which already contains $GITHUB_SHA" >&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
| fi | ||
| done | ||
| promote "$floating" | ||
| fi | ||
| case "$GITHUB_REF" in | ||
|
|
@@ -311,13 +339,13 @@ jobs: | |
| group: bump-consumers-python-sdlc | ||
| cancel-in-progress: false | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Mint CI token | ||
| id: ci-token | ||
| uses: actions/create-github-app-token@v3 | ||
| uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 | ||
| with: | ||
| client-id: ${{ vars.CRUNCHTOOLS_CI_CLIENT_ID }} | ||
| private-key: ${{ secrets.CRUNCHTOOLS_CI_APP_KEY }} | ||
|
|
||
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.
MEDIUM (Test Coverage): The new registry-copy path publishes the built digest under a second repository and verifies the read-back, but the changed tests do not exercise this external registry interaction. The separate promotion path also now copies tags to both repositories, with no test of the two-repository behavior or its failure cases.
Suggestion: Add a workflow-level test using a stubbed
skopeo(andgitfor the ancestry guard) to verify the copy and digest check for both repositories, including copy failure, digest mismatch, and a guard refusal when either repository is ahead.Evidence:
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.
Not a bug: the copy step checks itself. It reads the digest back from quay.io/crunchtools/sdlc and fails the job unless that digest equals the one it just tested. That is the same check the existing push and promote steps rely on, and none of these registry steps can run offline from a pull request, since PR runs have no Quay credentials by design.