Repository navigation
Harden the CI and update its pins monthly - #60
Merged
Merged
Conversation
dimitrivlachos
marked this pull request as ready for review
November 11, 2026 17:51
dimitrivlachos
added a commit
that referenced
this pull request
Nov 13, 2026
This is the dx2 side of fast-feedback-service [#169]. Since [#60] every package in `environment.yml` is pinned exactly and the Conda update workflow moves the pins once a month, so a `git pull` can leave a local environment behind without anyone noticing. The build then fails in ways that do not name the cause; on fast-feedback-service an environment still on fmt 11.2 against the 12.1 pin gave link errors between `fmt::v11` symbols and `libfmt.so.12`, which say nothing about the environment being out of date. This adds the same configure-time check, which compares the environment the build uses against `environment.yml` and warns with every package that does not match, along with the command to update it: ``` CMake Warning at cmake/Modules/CheckCondaPins.cmake:69 (message): The conda environment at .../ENV does not match the pins in environment.yml: fmt 12.2.0, pinned 11.2.0 Update it with: mamba env update -p .../ENV -f .../environment.yml ``` conda records every installed package as `conda-meta/<name>-<version>-<build>.json`, so the check is a glob per pin in plain CMake, with no Python and no conda call. The environment is the one holding the C++ compiler, since that is where the headers come from. It is only a warning, so building against a different environment on purpose still works. ### Changes - Added `cmake/Modules/CheckCondaPins.cmake`, ported from fast-feedback-service. The pin file and the environment's `conda-meta/history` are configure dependencies, so a pull that moves a pin, or an update to the environment, reruns the check on the next `ninja` without a manual reconfigure. - Dropped the macOS handling the original carries. dx2 solves the one `environment.yml` on both platforms, so every pin applies on both and there is no derived file to suggest. - Included it alongside the other build-configuration modules, so it only runs when dx2 is the top-level project and not when it is pulled in with `add_subdirectory`. A compiler from outside a conda environment skips the check entirely. [#169]: DiamondLightSource/fast-feedback-service#169 [#60]: #60
dimitrivlachos
added a commit
that referenced
this pull request
Nov 13, 2026
This is the dx2 side of fast-feedback-service [#170]. In [#60] I pinned every action to a commit SHA, since a tag such as `@v7` can be repointed by whoever controls the action, as happened with tj-actions and trivy-action, and a SHA cannot. It did trade neat pointers for ungainly SHAs, and it still left two gaps: a SHA fixes which commit runs but not whose repository it comes from, and it only reaches our own workflow files, so an action that calls other actions internally is only as pinned as its maintainers make it. GitHub has now released [workflow dependency lockfiles], which do the same job as the SHAs and close both gaps, so this PR moves dx2 over to them. It adds `.github/workflows/actions.lock`, generated by [`gh actions-lock`] v0.4.1, which records for each action its release tag, its commit, and the numeric IDs of the account and repository it belongs to. Once a workflow is in the lockfile, "the locked commit is what runs when the workflow executes", a commit that is not reachable from the recorded tag is rejected when the workflow runs. The 8 actions dx2 uses and the one they pull in transitively are all locked. With the commit held in the lockfile, the neat pointers come back: the workflows name exact releases (`actions/checkout@v7.0.1`), which is the form the tool writes and keeps. Dependabot needs no new configuration; when it bumps an action in a locked workflow, it regenerates the lockfile entry in the same pull request. ### Changes - Named every action by its exact release tag instead of its commit SHA, and updated the Dependabot header, which described it reading the version from the trailing comment. Every locked commit is the SHA it replaces, so no action changes version. - Added the lockfile, generated by `gh actions-lock` and checked with `gh actions-lock --verify`, which passes on all three workflows. After this merges, the lockfile can be made mandatory with an Actions policy. Under Settings -> Actions -> Policies, create a new policy, set its enforcement status to Active, target this repository's workflows, and enable the "Require lockfile" protection. A targeted workflow that is not in the lockfile is then blocked rather than resolved live.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This brings dx2 up to the same CI hardening that fast-feedback-service
picked up in #158, #161 and #164. Up until now, every workflow action
has been referenced by a mutable tag such as
@v7, and every conda packageexcept
hdf5and its filter plugins float, so each CI run takeswhatever the action owners and conda-forge happen to be publishing that
day. A tag is a pointer that its owner, or whoever compromises them, can
move; a pinned commit SHA or exact version cannot.
Pinning makes updating a chore, so it is automated. For the actions,
Dependabot proposes one grouped pull request a month, and only for
releases that have been out for at least seven days, which is usually
long enough for a compromised release to be noticed and pulled.
Security advisories bypass both the schedule and the cooldown.
Dependabot can also update conda pins, but it bumps each one to its
latest on its own and ignores the constraints packages place on each
other. Its first run on fast-feedback-service (#162) produced an
environment that broke the build and failed its tests
(tests, image). The conda pins here are
instead kept current by a monthly workflow from #164, which loosens
every pin to a lower bound, lets the conda solver choose the newest set
that installs on both linux-64 and osx-arm64, and opens one pull request
with the result.
requirements.txtbecomesenvironment.yml, a fullenvironment file that names its channel, since the solves read the file
as it is.
Changes
with the exact release in a trailing comment
(
@3d3c42e... # v7.0.1). No versions change; these are the same pinsfast-feedback-service uses where the two share an action.
versions the last green run on
main(40922709935) installed onboth Linux and macOS, so the build is unchanged.
ccachemoves intothe environment from its own install step.
hdf5is held on1.14.*,which the monthly update leaves alone, so the move to 2.x can follow
as its own change.
seven-day cooldown.
.github/scripts/conda_update.py, adapted fromfast-feedback-service's
conda/update.py. It moves the pins to thenewest versions that solve together on linux-64 and osx-arm64, the two
CI platforms, and prints each change as
name old -> new. dx2 has oneenvironment, and its compiler metapackages already supply clang on
macOS, so it solves the same file on both.
at 06:36 UTC, pushes a
conda-updatebranch, opens or updates thepull request, and dispatches the build on it, since a push made with
the job token starts no workflows.
build workflow had no
permissions:block and so inherited therepository default; it is now read-only. The docs workflow granted
pages: writeandid-token: writeto every job, including the buildon pull requests; those now sit on the deploy job only.
pushtrigger tomainand addedworkflow_dispatch, as fast-feedback-service did in 05e6e05. Abranch pushed to this repository with a pull request open used to run
both workflows twice.
The
FetchContentpins for mdspan and googletest, and the docsrequirements, are left as they are. Dependabot has no CMake support, and
the docs packages can follow separately if they are wanted.