Skip to content

Improve and modernise the CI workflow#3153

Merged
guusdk merged 10 commits intoigniterealtime:mainfrom
guusdk:CI-improvements
Mar 4, 2026
Merged

Improve and modernise the CI workflow#3153
guusdk merged 10 commits intoigniterealtime:mainfrom
guusdk:CI-improvements

Conversation

@guusdk
Copy link
Member

@guusdk guusdk commented Mar 4, 2026

This PR addresses a number of issues identified in the existing CI workflow, ranging from correctness problems to inefficiencies and maintenance concerns. Each change has been made in a separate, focused commit. Please refer to the individual commit messages for a detailed explanation of each.

Changes include:

  • Building the Docker image once and sharing it across jobs
  • Adding a concurrency block to cancel stale runs on active branches
  • Adding the missing integration job to the dependency gates of publish-maven, build-and-push-docker, and build-deb-artifact
  • Gating build-deb-artifact on the full test suite rather than just build
  • Removing the unnecessary build dependency from xcheck-database-version
  • Adjust the aioxmpp clone to a shallow checkout to avoid pulling unreferenced history from an external repository

guusdk added 6 commits March 4, 2026 18:29
…build-and-push-docker'

The publish-maven and build-and-push-docker jobs list many required jobs (aioxmpp, connectivity, etc.) but omit the integration job entirely. This means you could publish a build that failed its integration test suite.
This job depends only on build, not on any test jobs. A broken or failing build could still produce and upload a .deb artifact, which is potentially misleading. It should depend on the same gate as the publish jobs.
By applying concurrency configuration, multiple pushes in quick successino will prevent queuing up redundant full CI runs.
This job only reads source files checked out from the repo and runs a shell script. It never uses the compiled distribution or Maven artifacts. The needs: [build, ...] dependency forces it to wait unnecessarily. Removing the build dependency (keeping should-do-database-tests and check_branch) would let it run earlier in parallel.
The aioxmpp test uses a clone of an unpinned external repository (aioxmpp's). There's no need to pull the full history.
Previously, the Docker image was built independently in both the `integration` job (locally via `load: true`) and the `build-and-push-docker` job, meaning the image was built twice per CI run with no guarantee both builds produced identical output.

Introduce a new `build-docker` job that builds the image once after `build` completes, pushes it to GHCR tagged as `ci-<sha>`, and exposes the image tag and digest as job outputs.

The `integration` job now depends on `build-docker` and pulls the pre-built image rather than building locally. The `build-and-push-docker` job likewise pulls the same ephemeral image, retags it with final production tags via `docker/metadata-action`, and pushes those. The attestation step now references the digest from `build-docker` rather than a fresh build, ensuring provenance is accurate.

A cleanup step removes the ephemeral `ci-*` tag from GHCR after the final tags are pushed.
@guusdk guusdk requested review from Fishbowler, akrherz and dwd March 4, 2026 17:55
The earlier fix for reusing Docker images used GHCR as the intermediary, which fails for pull requests from forks due to insufficient registry permissions.

Instead, build the image once in a dedicated `build-docker` job, save it to a gzip-compressed tar archive via `docker save`, and share it as a workflow artifact with a 1-day retention. Downstream jobs (`integration` and `publish-docker`) download and restore the image via `docker load`, requiring no registry access at build or test time.
@guusdk
Copy link
Member Author

guusdk commented Mar 4, 2026

The original solution for sharing Docker images between steps relied on GHCR, which would not be available on forks. I've now switched to an approach that shares the docker image as an artifact (using docker save / docker load).

guusdk added 3 commits March 4, 2026 19:31
This is mainly done to perform cache-busting for the Docker-image build inside CI.
A recent code change in aioxmpp seems to have broken this test. Exclude it for the time being. See https://codeberg.org/jssfr/aioxmpp/pulls/417 for details.
Separate the cache-from and cache-to keys in the build-docker job so that each commit writes a fresh cache entry (keyed by SHA) while still reading from the stable hash-based cache to reuse Maven dependency layers.

Also expand the cache key hash to include the Dockerfile and entrypoint.sh, ensuring that changes to any of these files correctly bust the cache.
@guusdk guusdk force-pushed the CI-improvements branch from ca5413a to 0cb5a00 Compare March 4, 2026 20:08
Copy link
Member

@Fishbowler Fishbowler left a comment

Choose a reason for hiding this comment

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

LGTM. I've reviewed this commit-by-commit, and nothing looks wild or scary. I'd bet there's more we could do, but this looks like a great step forwards.

@guusdk guusdk merged commit a6677e6 into igniterealtime:main Mar 4, 2026
23 of 24 checks passed
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.

2 participants