Repository navigation
ci: publish the Crypt4GH decryption image - #74
Conversation
The decryption executor doesn't need pip at run time. The base image's pip vendors packages with fixable high findings (msgpack, urllib3, setuptools' pkg_resources), which would fail the image scans that CI and the release workflow run: uninstall pip after installing the pinned requirements. Refs #69 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
The smoke job now also scans the image with the shared scan-image action (Trivy): fixable findings go to code scanning (not for pull requests from forks), and the job fails on fixable critical and high ones, as the release scan would. Accepted findings go in .trivyignore.yaml, which the action requires. Refs #69 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
On a tag of foca-plugin-tes-data-crypt4gh, the release workflow now publishes the decryption image as elixircloud/foca-plugin-tes-data-crypt4gh-decrypt, following the organization's release pattern (as cloud-registry): push by digest (push), scan and smoke test the digest without credentials (scan), then attest, sign and tag it with the version (image), before PyPI and the GitHub release. Packages without an image skip these jobs; pypi and publish get explicit conditions for that. The Docker Hub organization is the variable DOCKERHUB_ORG (default elixircloud), so that forks publish to their own. The plugin's README, the proTES config example, the changelog and the release docs describe the published image and its verification. Closes #69 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
- Package images are named in IMAGES of scripts/release.py, returned by `release TAG` and tested, instead of a case statement in the workflow. - CI's image scan fails only if the plugin is affected, so that a new finding for the image doesn't block the other packages. - The image job also waits for the attested distributions, and leaves an existing tag of the same digest as it is (immutable tags). - Docs: the Images section after the PyPI notes, PEP 440 version tags, re-running all jobs after a failed scan, Docker Hub immutable tags, and the Dockerfile's build command from the repository root. Refs #69 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
test_images now also checks that every package with an image Dockerfile has an entry in IMAGES, so that a missing name fails CI instead of the release. Comments and docs rewrapped. Refs #69 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Reviewer's GuideData structuresDefine and validate which package owns each release image, and return that image name as release metadata.
ImplementationRemove pip from the decryption image after installing its pinned requirements to eliminate fixable vulnerabilities inherited from pip.
UIExplain the published image, digest-based use and verification, and update the plugin configuration example and changelog.
ConfigurationBuild and scan the image in CI, then publish each release image by digest, scan and smoke-test it, and attest, sign, and version-tag it before package publication.
Add the Trivy ignore configuration required by CI and release image scans.
DocumentationDocument image prerequisites, release workflow stages, scan recovery, and fork dry runs.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Documentation build overview
|
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #74 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 10
Lines 886 886
Branches 125 125
=========================================
Hits 886 886
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Refs #69 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Linked issuesChecked at commit 70036ea #69 ci: publish the Crypt4GH decryption image · 3 of 5 met · 1 to check by hand
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/release.yml" line_range="392" />
<code_context>
+ tag="${IMAGE}:${VERSION}"
+ if manifest="$(docker buildx imagetools inspect "${tag}" \
+ --format '{{ json .Manifest }}' 2> "${RUNNER_TEMP}/inspect.err")"; then
+ actual="$(jq -r .digest <<< "${manifest}")"
+ if [[ "${actual}" != "${DIGEST}" ]]; then
+ echo "::error::${tag} points to ${actual} already, not to ${DIGEST}; published tags don't move: release a new version"
</code_context>
<issue_to_address>
**Image releases are rejected**
When the release workflow checks an existing version tag or verifies a newly created one, `docker buildx imagetools inspect --format '{{ json .Manifest }}'` returns a manifest body without a top-level `digest`, so `jq -r .digest` yields `null`; the workflow rejects matching existing and newly created tags, causing the image release to fail and blocking PyPI publication.
Read the digest from an inspect output that actually contains it, and use that extraction for both tag checks.
Also at `.github/workflows/release.yml:428-429`.
</issue_to_address>
### Comment 2
<location path=".github/workflows/release.yml" line_range="426" />
<code_context>
+ if: ${{ steps.tag.outputs.exists != 'true' }}
+ run: |
+ tag="${IMAGE}:${VERSION}"
+ docker buildx imagetools create --tag "${tag}" "${IMAGE}@${DIGEST}"
+ actual="$(docker buildx imagetools inspect "${tag}" \
+ --format '{{ json .Manifest }}' | jq -r .digest)"
</code_context>
<issue_to_address>
**Other release image is lost**
When another publisher writes a different digest to the version tag after the absence check and before `imagetools create` runs, `docker buildx imagetools create` unconditionally overwrites the version tag with this workflow's digest, and the following inspection confirms the replacement rather than protecting the other publisher's manifest; the job succeeds and consumers can get the wrong release image.
Make version-tag creation conditional or atomic so it cannot overwrite a tag another publisher created after the absence check.
Also at `.github/workflows/release.yml:425`.
</issue_to_address>
### Comment 3
<location path=".github/workflows/release.yml" line_range="367" />
<code_context>
+ TAG: ${{ github.ref_name }}
+ REPOSITORY: ${{ github.server_url }}/${{ github.repository }}.git
+ run: |
+ refs="$(git ls-remote --tags "${REPOSITORY}" "refs/tags/${TAG}" "refs/tags/${TAG}^{}")"
+ # Annotated tags: the commit is the peeled ref (`^{}`)
+ commit="$(awk -v ref="refs/tags/${TAG}^{}" '$2 == ref { print $1 }' <<< "${refs}")"
</code_context>
<issue_to_address>
**Moved release tag leaves mismatched image**
When the Git release tag moves after the image job checks it but before the image version tag is published, `Tag image` still publishes the built digest under `${VERSION}`; the later `pypi` check then rejects the moved Git tag, leaving a published version image for a tag that names another commit.
Enforce a GitHub tag ruleset that prevents updates and deletion of release tags, as the release documentation recommends.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 3 findings to address first, and a release now publishes a signed, version-tagged decryption image that downstream operators may pull and run; if the image or release flow is wrong, it could expose task inputs or produce an unsafe executable artifact. Reverting stops future publication but cannot recall digests already pulled or undo their use.
Blocking findings: .github/workflows/release.yml:392, .github/workflows/release.yml:426, .github/workflows/release.yml:367
Brings in the teardown executor (#73). The changelog keeps the entries of both: the teardown entries and the published image. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary
Publishes the decryption image of
tes.data.crypt4ghwith each release of the plugin, asdocker.io/elixircloud/foca-plugin-tes-data-crypt4gh-decrypt:<version>. It follows the organization's release pattern, as cloud-registry'srelease.ymldoes.release.yml), on a tagfoca-plugin-tes-data-crypt4gh-v<version>:preparegets the package's image frompython -m scripts.release release(new keyimage, fromIMAGESinscripts/release.py). It fails for a package withimage/Dockerfilebut no image name, and the other way round.push(Push release image) builds the image of the pushed commit once (linux/amd64, SBOM and provenance attestations, version and commit labels). It pushes it by digest only, untagged, in thereleaseenvironment.scan(Scan release image) scans exactly that digest with the sharedscan-imageaction (Trivy, fails on fixable critical and high findings). It also runs the image'ssmoke.shon it. It has no credentials and no signing identity.image(Release image) runs afterattest,pushandscan. It checks that the tag still names the built commit and that the version tag doesn't already point to another digest. Then it attests the build provenance (also pushed to Docker Hub), signs the digest with cosign (keyless) and tags it with the version. A tag that already points to the same digest (a re-run) is left as it is.latesttag: the plugin'simagesetting names the image of the installed version, best by digest.pypiandpublishrun after it. Packages without an image skippush,scanandimage. A skipped dependency would otherwise skippypiandpublishtoo, so both get explicit conditions.vars.DOCKERHUB_ORG(defaultelixircloud), as in cloud-registry, so that forks publish to their own.ci.yml, jobsmoke, name unchanged): the job also scans the image with the sharedscan-imageaction.changes), so that a new finding for the image doesn't block the other packages. The release scan stays the hard gate..trivyignore.yaml(empty), which the action requires.pkg_resources), with 5 fixable high findings that would fail every scan. The executor doesn't need pip.cosign verifyandgh attestation verify. Also its proTES config example.docs/releasing.md: a new section "Images", the new jobs, Docker Hub prerequisites, when to re-run all jobs after a failed scan, approvals and fork dry runs.dockerandpipentries forplugins/tes/data/crypt4gh/image), sodependabot.ymlneeds no change.Closes #69
Verification
pre-commit run --all-files: all hooks passed (actionlint, ruff, mypy, semgrep, gitleaks, ast-grep, package conventions).rhysd/actionlintimage) on all workflows: no findings.python -m scripts.checks check: OK.coverage run --source scripts,docs -m pytest tests: 142 passed, 100% coverage. New tests cover the image mapping (test_release_image,test_images).mkdocs build --strict: OK.image/smoke.shpassed on it.--ignore-unfixed --severity CRITICAL,HIGH --exit-code 1and.trivyignore.yaml. Before dropping pip it had 5 high findings, all in pip's vendored packages. After dropping pip, the scan exits with 0.docker buildx imagetools inspecton a missing tag of an existing repository printsnot found, which the version-tag check accepts. A missing repository fails with another error, which fails the check.CI passed,Smoke test(with the new scan, which uploaded its results as the code scanning check "Trivy") and Read the Docs. There are no open code scanning alerts for the PR.Review
Two rounds with the adversarial and quality reviewer subagents; I fixed every finding except those below.
Declined review findings
smoke(it now also scans the image). Declined: the name "Smoke test" still describes its main purpose, and the job comment and the workflow header now mention the scan. A rename would only churn the docs.permissionskey raises their token tosecurity-events: write. cloud-registry uses the same expression. The adversarial reviewer confirmed that Dependabot PRs can upload.IMAGESassertion intest_images. Declined: it pins the decided image name, so that a change to it is deliberate.scan.yml). Out of scope for ci: publish the Crypt4GH decryption image #69. Without alatesttag, a scheduled scan needs the latest released version. This is a possible follow-up issue.Maintainer steps
These are decided. They are needed before the plugin's first release, but none of them blocks merging this PR:
elixircloud/foca-plugin-tes-data-crypt4gh-decrypt. Make sure the token inDOCKERHUB_TOKENcan push to it.^[0-9]), so that cosign'ssha256-…tags stay writable.releaseenvironment's Docker Hub secrets. I assumed that it can readDOCKERHUB_LOGINandDOCKERHUB_TOKEN(organization secrets, as for cloud-registry), but agents can't read environments through the API. If it can't, add them to the environment.foca-plugin-tes-data-crypt4gh, dry-run the release in a fork:DOCKERHUB_ORGto a Docker Hub organization of your own, with a public repositoryfoca-plugin-tes-data-crypt4gh-decrypt, and give the fork'sreleaseenvironment Docker Hub secrets for it.scanscans and smoke tests the digest, and thatimagesigns and tags it.foca-plugin-tes-routing-distance) still releases, withpush,scanandimageskipped.cosign verifyandgh attestation verifycommands pass on the published digest.docs/releasing.md).releaseenvironment requires reviewers, a crypt4gh release now waits for three approvals:push,imageandpypi.🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary by Sourcery
Publish and verify the Crypt4GH decryption image as part of the plugin release workflow.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: