How to add overlays for PRs
.nix/config.nix
like mathcomp-real-closed.override.version = "<github_login>:<branch>";
In case a PR breaks a "child project" tested in math-comp's CI, it is possible to slightly edit the .gitlab-ci.yml
file within the PR to act as an overlay (borrowing the terminology used in the coq repository).
The different steps are summarized below on a hypothetical example:
- assuming a math-comp PR #1234 breaks the
ci-fourcolor-dev
job defined as:ci-fourcolor-dev: extends: .ci-fourcolor variables: COQ_VERSION: "dev"
- assuming a non-backward-compatible, downstream patch has been pushed to a separated branch
fix-foo
in a forkhttps://github.com/user/fourcolor.git
- then one would only need to add one commit in the PR #1234, replacing the above four lines with:
where
ci-fourcolor-dev: extends: .ci-fourcolor variables: COQ_VERSION: "dev" # lines below have been added except: - tags - merge_requests - schedules - /^pr-1234$/ - /^github-branch$/ ci-fourcolor-dev-1234: extends: .ci-fourcolor variables: COQ_VERSION: "dev" CONTRIB_URL: "https://github.com/user/fourcolor.git" CONTRIB_VERSION: "fix-foo" only: - /^pr-1234$/ - /^github-branch$/
github-branch
denotes the name of the GitHub source branch of the PR, assuming it is part of the upstreammath-comp
repo. If the PR is opened from a math-comp fork, the two- /^github-branch$/
lines should be skipped. - so the upcoming CI builds in
pr-1234
(as well as in thegithub-branch
, if specified) will use the relevant fourcolor branch, while after the merge inmaster
, the regular branch of fourcolor will be used for all subsequent builds inmaster
. - after math-comp
master
has been built and pushed to https://hub.docker.com/r/mathcomp/mathcomp-dev, the downstream PR containing the non-backward-compatible patch can be merged. - finally (for cleaning purposes), the commit that had changed the
.gitlab-ci.yml
file to configure the overlay can be reverted inmaster
usinggit revert $COMMIT_HASH
, as it is now a "no-op".
Note: as noticed in PR #451, we need to repeat the lines below from the .ci
job in .gitlab-ci.yml in the overlay job that adds other except
rules, otherwise the scheduled pipeline that deploys math-comp master to mathcomp/mathcomp-dev:coq-dev
on Docker Hub every night would fail:
except:
- tags
- merge_requests
- schedules