Skip to content

ci: publish the Crypt4GH decryption image - #74

Merged
uniqueg merged 7 commits into
devfrom
ci/69-publish-crypt4gh-image
Nov 12, 2026
Merged

uniqueg merged 7 commits into
devfrom
ci/69-publish-crypt4gh-image

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Publishes the decryption image of tes.data.crypt4gh with each release of the plugin, as docker.io/elixircloud/foca-plugin-tes-data-crypt4gh-decrypt:<version>. It follows the organization's release pattern, as cloud-registry's release.yml does.

  • Release workflow (release.yml), on a tag foca-plugin-tes-data-crypt4gh-v<version>:
    • prepare gets the package's image from python -m scripts.release release (new key image, from IMAGES in scripts/release.py). It fails for a package with image/Dockerfile but 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 the release environment.
    • scan (Scan release image) scans exactly that digest with the shared scan-image action (Trivy, fails on fixable critical and high findings). It also runs the image's smoke.sh on it. It has no credentials and no signing identity.
    • image (Release image) runs after attest, push and scan. 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.
    • There is no latest tag: the plugin's image setting names the image of the installed version, best by digest.
    • pypi and publish run after it. Packages without an image skip push, scan and image. A skipped dependency would otherwise skip pypi and publish too, so both get explicit conditions.
    • The Docker Hub organization is vars.DOCKERHUB_ORG (default elixircloud), as in cloud-registry, so that forks publish to their own.
  • CI (ci.yml, job smoke, name unchanged): the job also scans the image with the shared scan-image action.
    • Fixable findings go to code scanning, except for pull requests from forks.
    • The job fails on them only if the plugin is affected (job changes), so that a new finding for the image doesn't block the other packages. The release scan stays the hard gate.
    • New file .trivyignore.yaml (empty), which the action requires.
  • Image: pip is uninstalled after the pinned requirements are installed. The base image's pip vendors msgpack 1.1.2, urllib3 2.7.0 and setuptools 70.3.0 (pkg_resources), with 5 fixable high findings that would fail every scan. The executor doesn't need pip.
  • Docs:
    • The plugin README's image section: the published image, how to look up its digest, cosign verify and gh attestation verify. Also its proTES config example.
    • The Dockerfile header and the changelog.
    • 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.
    • Dependabot already covers the image (docker and pip entries for plugins/tes/data/crypt4gh/image), so dependabot.yml needs no change.

Closes #69

Verification

  • pre-commit run --all-files: all hooks passed (actionlint, ruff, mypy, semgrep, gitleaks, ast-grep, package conventions).
  • actionlint 1.7.7 with shellcheck (the rhysd/actionlint image) 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.
  • I built the image locally from the branch, and image/smoke.sh passed on it.
  • I scanned it with Trivy 0.75.0 (the shared action's version), using --ignore-unfixed --severity CRITICAL,HIGH --exit-code 1 and .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 inspect on a missing tag of an existing repository prints not found, which the version-tag check accepts. A missing repository fails with another error, which fails the check.
  • Not run: the release workflow end to end. It pushes, signs and tags images on Docker Hub, so it needs a fork dry run with Docker Hub credentials (see "Maintainer steps").
  • CI: all checks passed, including 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

  • Rename the CI job 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.
  • Skip the SARIF upload for Dependabot pull requests. Declined: Dependabot PRs come from the same repository, and the permissions key raises their token to security-events: write. cloud-registry uses the same expression. The adversarial reviewer confirmed that Dependabot PRs can upload.
  • Drop the literal IMAGES assertion in test_images. Declined: it pins the decided image name, so that a change to it is deliberate.
  • Scheduled scan of the released image (scan.yml). Out of scope for ci: publish the Crypt4GH decryption image #69. Without a latest tag, 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:

  1. Create the public Docker Hub repository elixircloud/foca-plugin-tes-data-crypt4gh-decrypt. Make sure the token in DOCKERHUB_TOKEN can push to it.
  2. Optionally, enable immutable tags for that repository on Docker Hub for version tags (e.g. the pattern ^[0-9]), so that cosign's sha256-… tags stay writable.
  3. Check the release environment's Docker Hub secrets. I assumed that it can read DOCKERHUB_LOGIN and DOCKERHUB_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.
  4. Before the first tag of foca-plugin-tes-data-crypt4gh, dry-run the release in a fork:
    • Set the fork's DOCKERHUB_ORG to a Docker Hub organization of your own, with a public repository foca-plugin-tes-data-crypt4gh-decrypt, and give the fork's release environment Docker Hub secrets for it.
    • Push a test tag. In the logs, check that the image goes to that organization, that scan scans and smoke tests the digest, and that image signs and tags it.
    • Check that a plugin without an image (e.g. foca-plugin-tes-routing-distance) still releases, with push, scan and image skipped.
    • Check that the README's cosign verify and gh attestation verify commands pass on the published digest.
    • PyPI publishing needs TestPyPI in the fork (see docs/releasing.md).
  5. If the release environment requires reviewers, a crypt4gh release now waits for three approvals: push, image and pypi.

🤖 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:

  • Publish the Crypt4GH decryption image to Docker Hub for each plugin release with version tagging, provenance attestation, and keyless signing.

Bug Fixes:

  • Remove pip from the decryption image to eliminate fixable vulnerabilities inherited from its vendored dependencies.

Enhancements:

  • Add release-time image discovery and validation to ensure packages with Dockerfiles are included in image publishing.
  • Scan and smoke test release image digests before signing and tagging them.
  • Extend CI image checks with Trivy vulnerability scanning and conditional failure behavior.

CI:

  • Update release orchestration to build, scan, attest, sign, and publish package images while preserving releases for packages without images.

Documentation:

  • Document image usage, digest and signature verification, Docker Hub prerequisites, and image release procedures.

Tests:

  • Add coverage for package image mapping and validation.

uniqueg and others added 5 commits November 12, 2026 04:17
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
@sourcery-ai

sourcery-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Define and validate which package owns each release image, and return that image name as release metadata.

  • scripts/release.py L85-92, L103-110, L122-130 (+1 small edits)
  • tests/test_release.py L29, L34-74

Implementation

Remove pip from the decryption image after installing its pinned requirements to eliminate fixable vulnerabilities inherited from pip.

  • plugins/tes/data/crypt4gh/image/Dockerfile L3-11, L37-45

UI

Explain the published image, digest-based use and verification, and update the plugin configuration example and changelog.

  • plugins/tes/data/crypt4gh/CHANGELOG.md L17, L24-28
  • plugins/tes/data/crypt4gh/README.md L174-212, L227-228

Configuration

Build 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.

  • .github/workflows/ci.yml L6-9, L300-322, L340-347
  • .github/workflows/release.yml L8-25, L102-116, L230-448 (+4 small edits)

Add the Trivy ignore configuration required by CI and release image scans.

  • .trivyignore.yaml L1-17

Documentation

Document image prerequisites, release workflow stages, scan recovery, and fork dry runs.

  • docs/releasing.md L156-165, L177-203, L256-284 (+4 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

read-the-docs-community Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 foca-plugins | 🛠️ Build #35832285 | 📁 Comparing 70036ea against latest (acbfb0c)

  🔍 Preview build  

2 files changed
± catalogue/index.html
± releasing/index.html

@github-advanced-security

Copy link
Copy Markdown

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:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (712780d) to head (70036ea).

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           
Flag Coverage Δ
foca-plugin-generic-example-noop 100.00% <ø> (ø)
foca-plugin-generic-routing-random 100.00% <ø> (ø)
foca-plugin-tes-data-crypt4gh 100.00% <ø> (ø)
foca-plugin-tes-routing-distance 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 12, 2026 06:40
@sourcery-ai

sourcery-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit 70036ea

#69 ci: publish the Crypt4GH decryption image · 3 of 5 met · 1 to check by hand

# Requirement Status Notes
1 Publish the image on the plugin tag using the release sequence: push by digest, scan, sign, attest, then tag. 🟡 Partly met The workflow pushes by digest, scans, attests, signs, and tags the image, but it attests before signing.
2 Decide the image name. ✅ Met The image name is defined in IMAGES in scripts/release.py.
3 Have the maintainer create the Docker Hub repository. 👀 Check by hand (external system) Check that the public Docker Hub repository elixircloud/foca-plugin-tes-data-crypt4gh-decrypt has been created.
4 Point the plugin README and proTES config example to the published image. ✅ Met The README documents the Docker Hub image and the proTES example uses it by digest.
5 Keep Dependabot covering the image. ✅ Met Dependabot still has Docker and pip entries for plugins/tes/data/crypt4gh/image.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New gaps against the linked issues

Comment thread .github/workflows/release.yml Resolved
@uniqueg
uniqueg merged commit c57c78e into dev Nov 12, 2026
174 checks passed
@uniqueg
uniqueg deleted the ci/69-publish-crypt4gh-image branch November 12, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: publish the Crypt4GH decryption image

2 participants