Repository navigation
CI pipeline
The template adds two GitHub Actions workflows to your repository. This page explains what they do and when.
| Workflow | File | Triggers | Calls |
|---|---|---|---|
| Rock pipeline | .github/workflows/rock.yml |
push to main, pull request to main, manual |
canonical/rocks-actions → Rock.yaml
|
| Threat monitor | .github/workflows/threats.yml |
daily at 01:00 UTC, manual |
canonical/rocks-actions → Security.yaml
|
Both pass the repository's secrets to the reusable workflows (secrets: inherit).
flowchart LR
V[Validate] --> B[Build] --> T[Test] --> U[Upload]
U -->|"if ghcr.upload: true"| G[GHCR]
U -->|"if images[].registries is set"| X[Extra registries]
- Reads and validates
.github/ci.yaml. Any error here fails the run immediately, with a message pointing to the problem. See the CI configuration reference and Troubleshooting for guidance on how to solve these issues. - Expands the
imageslist into a build matrix (one entry per rock) and an upload matrix (one entry per rock and extra registry). - Reads each rock's
name,versionandbaseto compute its image tag. - Chooses the runners for each architecture.
If an image's directory has no rockcraft.yaml, it is skipped with a warning. If no image remains, the Build, Test and Upload stages are skipped entirely and the pipeline succeeds. This is why a freshly created repository does not fail.
For each rock, and each architecture in its platforms:
- Checks out your repository (using
REPO_CLONER_TOKENfor private and internal repositories). - Attaches Ubuntu Pro, if requested.
- Packs the rock with Rockcraft.
- Runs your spread tests, if the rock has a
spread.yaml.
The per-architecture results are then assembled into a single multi-architecture OCI archive, stored as a workflow artifact. Pro-enabled artifacts are encrypted with your passphrase.
The artifact is named after the rock's directory (/ replaced by -), or after the rock's name when the rock is at the repository root. For Pro builds, the enabled services are appended (for example my-rock-0.1-24.04-esm-apps).
Runs the generic checks on every built rock. A failure for one rock does not cancel the others.
Runs only when all of the following are true:
- The Validate stage found at least one rock to build, and the Test stage succeeded.
- The event is not a pull request.
- The ref is
main.
Then, per rock:
-
GHCR: if
ghcr.uploadistrue, the image is pushed toghcr.io/<owner>/<repository>/<name>:<tag>using the workflow'sGITHUB_TOKEN. Pro-enabled rocks are not uploaded to GHCR from public repositories. -
Additional registries: for each registry listed in the image's
registries, the image is pushed to<uri>/<name>:<tag>.
On pull requests and on branches other than main, the pipeline stops after the Test stage, so nothing is published.
Tip
A manual run (workflow_dispatch) of the pipeline on main also uploads. Run it on another branch to build and test without publishing.
Runs daily and on demand. If ghcr.cve-scan is enabled, it pulls each published image from GHCR, scans it for vulnerabilities and opens or updates a GitHub issue when it finds some.
The template calls canonical/rocks-actions through a full commit SHA (with the release in a trailing comment), which in turn pins the workflows and actions it uses. This makes runs reproducible and protects you from unreviewed changes. To pick up fixes and features, bump the pin as described in Maintaining Your Repository.
Almost everything you will want to change is in .github/ci.yaml:
- which rock directories are built
- whether to publish to GHCR
- additional registries and their credentials
- Ubuntu Pro services
- whether to scan for vulnerabilities
The workflow files themselves normally do not need to be modified.