Skip to content

ci: fix image tags and notify Pubgrade on release - #68

Merged
uniqueg merged 13 commits into
devfrom
ci/release
Nov 6, 2026
Merged

uniqueg merged 13 commits into
devfrom
ci/release

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #61. Part of #72. Based on dev (#64 merged); independent of #67.

  • release.yml / Release, as in the organisation's other repositories: a tag vX.Y.Z publishes X.Y.Z to the same image name, latest only for the highest release on main, and never touches other versions. By digest, after checks of the tag (signed, annotated, on main), of the versions in pom.xml and CITATION.cff, and of CI for the commit's push to dev, and a scan of the digest.
  • A version that is already published is refused before the new digest is attested and signed; registry errors fail that check instead of passing it.
  • Pre-release tags (vX.Y.ZrcN, also aN, bN) publish their own tag only, for rehearsals; CITATION.cff then needs the full version (e.g. 1.2.0rc1).
  • After publishing, one POST /repositories/{id}/builds to Pubgrade, in the environment pubgrade. It's skipped when PUBGRADE_URL, PUBGRADE_REPOSITORY_ID and PUBGRADE_TOKEN are unset, and fails if only some are set. HTTPS only.
  • Dependency: the call needs Pubgrade's publish mode, feat: publish prebuilt images without a build Pubgrade#33, which isn't on its dev yet. The body uses the existing schema (images[].name, head_commit.tag), so check it against Switch to GitHub Actions instead of Travis CI #33 when that merges, and leave the settings unset until then.
  • No GitHub release: this workflow publishes the image only.

Needs before the first tag

Verified

  • YAML parses (yq); actionlint runs in CI (Lint).
  • Locally: tag pattern, version lookup in pom.xml, the CITATION.cff version regex (1.2.0rc1), highest-tag selection, and that curl refuses http://.
  • Review: adversarial and quality reviewers, two rounds; findings fixed except those below.
  • Not run: the workflow itself, as it needs a tag and Docker Hub credentials. No fork dry run. A rehearsal tag (v1.2.0rc1) covers it, before the real tag.
  • CI on this PR: see the checks.

Declined review findings

  • Exact tag matching at Pubgrade and a digest in the body: belong to the design of Pubgrade#33.
  • Two-part tags (v1.0, v1.1) in the latest decision: v1.2.0 is above them.
  • A newer release can cancel an older one waiting for publish (one pending job per concurrency group): documented in the header (re-run failed jobs); same in the other repositories.
  • Duplicated steps between ci.yml and release.yml (login, attest, sign, tag loop): the org's pattern; no shared script yet.
  • No check of the version inside the image: the app doesn't report its version.

🤖 Generated with Claude Code

uniqueg and others added 3 commits November 5, 2026 05:38
Add ci.yml as in the org's other repositories (PR title, lint, test,
smoke test, image scan, gate). The scan only reports until the
dependency update.

The base image of the Dockerfile no longer exists; build from source on
Temurin 8 instead (not Alpine: TLS handshakes fail there on Java 8).
Add a .dockerignore.

Remove the old workflows, which can't run any more and would publish
over the tag of the last release on every push to master, and Travis.

Closes #59

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move to the last releases of the Spring Boot 2.7 line, and pin the
transitive dependencies the scan flags. spring-security-oauth2 2.5
makes its exception translator generic, which the entry point adapts
to.

What is fixed only in Spring Boot 3 goes to .trivyignore.yaml, each
entry with its reason and expiry date. The scan in CI now fails on
fixable critical and high findings.

Closes #60

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add release.yml as in the org's other repositories: a tag vX.Y.Z
publishes X.Y.Z (and latest for the highest release) to the same image
name, by digest, after checks of the tag and of CI, and a scan. Other
version tags stay untouched.

After that, one POST to Pubgrade, skipped unless its settings are set.
It needs Pubgrade's publish mode (elixir-cloud-aai/Pubgrade#33).

Closes #61

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR consolidates CI and release automation around pinned, permission-minimized GitHub Actions: every change is tested and scanned, releases are validated and published by a scanned digest with controlled stable/pre-release tags, and optionally notify Pubgrade after publication. It also makes container builds self-contained and reproducible while refreshing dependencies and documenting the new process.

Sequence diagram for the validated image release and Pubgrade notification

sequenceDiagram
    participant Git as GitHub tag push
    participant Prepare as prepare
    participant Push as push
    participant Scan as scan
    participant Publish as publish
    participant Registry as Docker Hub
    participant Pubgrade as Pubgrade

    Git->>Prepare: Check release tag and commit
    Prepare->>Prepare: Check that CI passed for the release commit
    Prepare->>Push: version and sha
    Push->>Registry: Build and push image by digest
    Push-->>Scan: digest
    Scan->>Registry: Scan image digest
    Scan-->>Publish: Scan passed
    Publish->>Registry: Attest build provenance
    Publish->>Registry: Sign image
    Publish->>Registry: Tag image
    Publish-->>Pubgrade: POST /repositories/{id}/builds
Loading

Flow diagram for stable and pre-release image tags

flowchart TD
    Tag["Signed annotated vX.Y.Z, vX.Y.ZaN, vX.Y.ZbN, or vX.Y.ZrcN"] --> Validate["Validate tag, pom.xml, master ancestry, and CI"]
    Validate --> Digest["Push one image digest and scan it"]
    Digest --> Stable{"Stable tag is highest release on master?"}
    Stable -->|Yes| StableTags["Publish X.Y.Z and latest"]
    Stable -->|No| VersionTag["Publish X.Y.Z only"]
    Digest --> Pre["Pre-release tag"]
    Pre --> PreTag["Publish X.Y.ZaN, X.Y.ZbN, or X.Y.ZrcN only"]
Loading

File-Level Changes

Change Details Files
Replaces the legacy CI and publishing workflows with a gated, comprehensive GitHub Actions CI pipeline.
  • Adds PR title validation, workflow linting, Maven unit/integration tests, container smoke tests, and Trivy image scanning.
  • Adds a single required gate that accounts for intended skipped jobs and handles pull-request concurrency.
  • Pins actions and scanner images, uploads coverage, and limits workflow permissions.
.github/workflows/ci.yml
.github/workflows/docker-build-publish.yml
.github/workflows/maven-check.yml
.github/workflows/maven-publish.yml
.travis.yml
Implements a validated, digest-first release workflow for stable and pre-release container tags.
  • Validates signed annotated version tags, matching pom.xml versions, ancestry on master, and successful CI for the exact release commit.
  • Builds and pushes once by digest, scans that digest separately, then attests, signs, and applies only the version tag plus latest for the highest stable release.
  • Adds protected release environments, concurrency controls, Docker metadata, provenance, and post-tag digest verification.
.github/workflows/release.yml
README.md
Adds optional Pubgrade release notifications with strict configuration and transport checks.
  • Sends one HTTPS POST after publishing using the configured repository identifier, image version, and source tag.
  • Skips only when all settings are absent and fails on partial configuration or invalid identifiers; keeps the token out of command arguments.
.github/workflows/release.yml
README.md
Modernizes reproducible image builds and dependency/security maintenance.
  • Changes the Dockerfile to a pinned multi-stage Java 8 build/runtime image and removes the requirement for a prebuilt artifact.
  • Adds grouped monthly Dependabot updates for Maven, GitHub Actions, and Docker dependencies.
  • Updates Spring/Guava and selected dependency-management versions, records scoped Trivy exceptions with expiry dates, and adjusts a generic OAuth exception translator type.
Dockerfile
.github/dependabot.yml
pom.xml
.trivyignore.yaml
src/main/java/uk/ac/ebi/tsc/tesk/config/security/CustomAuthenticationEntryPoint.java
.dockerignore

Possibly linked issues


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

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.90%. Comparing base (79db934) to head (8d02074).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev      #68   +/-   ##
=======================================
  Coverage   55.90%   55.90%           
=======================================
  Files          64       64           
  Lines        2150     2150           
  Branches      233      233           
=======================================
  Hits         1202     1202           
  Misses        807      807           
  Partials      141      141           

☔ 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 5, 2026 05:07

@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 4 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="256" />
<code_context>
+          for tag in "${tags[@]}"; do
+              docker buildx imagetools create --tag "${tag}" "${IMAGE_NAME}@${DIGEST}"
+              actual="$(docker buildx imagetools inspect "${tag}" \
+                  --format '{{ json .Manifest }}' | jq -r .digest)"
+              if [[ "${actual}" != "${DIGEST}" ]]; then
+                  echo "::error::${tag} points to ${actual}, expected ${DIGEST}"
</code_context>
<issue_to_address>
**Every publish check fails**

When a release image is tagged, `imagetools inspect --format '{{ json .Manifest }}'` returns a manifest without a `digest` field, so `jq -r .digest` returns `null` and the comparison fails after the image tags are pushed. The publish job fails and Pubgrade is not notified.

Read the inspected image's digest from a field or command that actually returns it, then compare that value with `${DIGEST}`.

Also at `.github/workflows/release.yml:257`.
</issue_to_address>

### Comment 2
<location path=".github/workflows/release.yml" line_range="32-33" />
<code_context>
+# edits that leave the title unchanged (e.g., of the description, also by bots)
+# share a group of their own, so that they cancel each other but not the run
+# for the pull request's commit
+concurrency:
+  group: >-
+    ${{ github.workflow }}-${{
</code_context>
<issue_to_address>
**Latest points to an older image**

When stable releases of different versions overlap and the older run selects itself as highest before the newer tag appears, the older run uses its stale tag snapshot to decide to update `latest`, then pushes its digest after the newer release has moved `latest` forward. Consumers pulling `latest` are sent back to the older image.

Ensure a release can update `latest` only when its version is still the highest at the time the tag is written.

Also at `.github/workflows/release.yml:245-254`.
</issue_to_address>

### Comment 3
<location path=".github/workflows/release.yml" line_range="254" />
<code_context>
+              tags+=("${IMAGE_NAME}:latest")
+          fi
+          for tag in "${tags[@]}"; do
+              docker buildx imagetools create --tag "${tag}" "${IMAGE_NAME}@${DIGEST}"
+              actual="$(docker buildx imagetools inspect "${tag}" \
+                  --format '{{ json .Manifest }}' | jq -r .digest)"
</code_context>
<issue_to_address>
**Reruns replace published version images**

When an operator reruns all jobs for an already-published release, `imagetools create` retargets the existing `X.Y.Z` tag to the newly built digest, so clients pulling that version can receive a different image even though the release version is unchanged.

Refuse to retarget an existing version tag unless its digest already matches, or require an explicit version-bump process to publish a different digest.
</issue_to_address>

### Comment 4
<location path=".github/workflows/release.yml" line_range="304-306" />
<code_context>
+          # HTTPS only (also for redirects, which aren't followed anyway); the
+          # token goes in through stdin, not the command line
+          curl --proto '=https' --silent --show-error --fail-with-body --max-time 300 \
+              --request POST "${PUBGRADE_URL%/}/repositories/${PUBGRADE_REPOSITORY_ID}/builds" \
+              --header 'Content-Type: application/json' \
+              --data "${body}" \
+              --config - <<< "header = \"X-Project-Access-Token: ${PUBGRADE_TOKEN}\""
</code_context>
<issue_to_address>
**Pubgrade receives duplicate notifications**

When pubgrade accepts a request but the workflow does not record success, or an operator reruns the failed notification job, the notification job sends the same build-creation POST again; if Pubgrade records each POST as a build, subscribed deployments receive duplicate notifications for the release.

Make build-creation requests idempotent so retries and reruns do not create duplicate notifications.
</issue_to_address>

Linked issues

#61 ci: fix image tags and notify Pubgrade on release · 3 of 3 met

# Requirement Status Notes
1 Publish the image for vX.Y.Z as X.Y.Z and latest only if it is the highest release, after checking the tag, CI, and image scan. ✅ Met The release workflow checks the version, signature, master ancestry, and successful CI run; it builds and scans the image by digest before tagging it.
2 After the push, POST to Pubgrade on a tag, using the configured URL, repository, and token; skip the call when settings are unset. ✅ Met The notify job runs after publishing, skips when all three settings are unset, rejects partial configuration, and sends one HTTPS POST.
3 Document how to release and which settings the workflow uses. ✅ Met The README describes release tags, image tags, release checks and approval, and the Pubgrade environment settings.

Sourcery assessment

Needs a human reviewer. 4 findings to address first, the security scan did not finish, and a mistake in the release workflow could publish an incorrect image under a version tag or latest, then send a Pubgrade notification that prompts subscribed deployments to act on it. Reverting the workflow cannot retract images already pulled or undo notifications already sent.

Blocking findings: .github/workflows/release.yml:256, .github/workflows/release.yml:33, .github/workflows/release.yml:254, .github/workflows/release.yml:306


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
Comment thread .github/workflows/release.yml Resolved
uniqueg and others added 4 commits November 5, 2026 06:13
A re-run of all jobs builds a new digest: refuse it if X.Y.Z points to
another one. Publish one release at a time, so that latest is decided
and written in one go.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Align CI with the branching model of the org's other repositories
(`dev` + `main`): run on pull requests and pushes to `dev`; on pushes,
push the image by digest in the environment `dev-images`, scan exactly
that digest, then attest, sign and tag it `dev` and `sha-<commit>`, as
cloud-registry does. Add the weekly scan of `latest` (`scan.yml`), let
Dependabot target `dev`, and fail pushes on Codecov upload errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Publish only on pushes to this repository, or to forks that set
`DOCKERHUB_ORG` (`PUBLISH`, as in proTES and foca): other runs scan a
local build, upload nothing to code scanning and don't fail on Codecov
upload errors, and the gate allows the skipped publishing jobs. Name
the environment and secrets publishing needs in the README, and fix
comments from the review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg mentioned this pull request Nov 6, 2026
uniqueg and others added 6 commits November 6, 2026 05:37
# Conflicts:
#	.github/workflows/ci.yml
# Conflicts:
#	.github/workflows/ci.yml
#	.trivyignore.yaml
The branching model is now `dev` + `main`: release commits must be on
`main`, `latest` goes by the tags on `main`, and CI must have passed for
the push of the release commit to `dev`. As in cloud-registry, the
version in `CITATION.cff` must be the release version, as Zenodo
archives the tagged metadata.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refuse a version that is already published before attesting and
signing the new digest, and fail on registry errors instead of taking
them for a missing tag. Name the tag rulesets that protect the release
and Pubgrade secrets, and clarify the version rules for pre-releases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Restore the files of #67 to their state on `dev`, so that this pull
request no longer depends on #67, which waits for a decision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit c0d197c into dev Nov 6, 2026
25 of 32 checks passed
@uniqueg
uniqueg deleted the ci/release branch November 6, 2026 04:54
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: fix image tags and notify Pubgrade on release

1 participant