spack/share/spack
Scott Wittenburg 685e3d7ae9
spack ci: filter untouched pkgs from PR pipelines (#29697)
We've previously generated CI pipelines for PRs, and they rebuild any packages that don't have
a binary in an existing build cache.  The assumption we were making was that ALL prior merged
builds would be in cache, but due to the way we do security in the pipeline, they aren't. `develop`
pipelines can take a while to catch up with the latest PRs, and while it does that, there may be a
bunch of redundant builds on PRs that duplicate things being rebuilt on `develop`.  Until we can
do better caching of PR builds, we'll have this problem.

We can do better in PRs, though, by *only* rebuilding things in the CI environment that are actually
touched by the PR.  This change computes exactly what packages are changed by a PR branch and
*only* includes those packages' dependents and dependencies in the generated pipeline.  Other
as-yet unbuilt packages are pruned from CI for the PR.

For `develop` pipelines, we still want to build everything to ensure that the stack works, and to ensure
that `develop` catches up with PRs. This is especially true since we do not do rebuilds for *every* commit
on `develop` -- just the most recent one after each `develop` pipeline finishes.  Since we skip around,
we may end up missing builds unless we ensure that we rebuild everything.

We differentiate between `develop` and PR pipelines in `.gitlab-ci.yml` by setting 
`SPACK_PRUNE_UNTOUCHED` for PRs. `develop` will still have the old behavior.

- [x] Add `SPACK_PRUNE_UNTOUCHED` variable to `spack ci`
- [x] Refactor `spack pkg` command by moving historical package checking logic to `spack.repo`
- [x] Implement pruning logic in `spack ci` to remove untouched packages
- [x] add tests
2022-03-30 17:17:29 -07:00
..
bash Fix tab completion erroring with spack unit-test (#29405) 2022-03-09 16:09:57 +01:00
bootstrap/github-actions Bootstrap GnuPG (#24003) 2021-11-02 23:15:24 -07:00
csh Update copyright year to 2022 2022-01-14 22:50:21 -08:00
docker Update copyright year to 2022 2022-01-14 22:50:21 -08:00
docs/docker/module-file-tutorial Update copyright year to 2022 2022-01-14 22:50:21 -08:00
gitlab spack ci: filter untouched pkgs from PR pipelines (#29697) 2022-03-30 17:17:29 -07:00
keys Update the Public key of the tutorial (#27370) 2021-11-12 11:46:02 +01:00
logo add artisanal handcrafted SVG Spack logo. (#6165) 2017-11-06 22:42:16 -08:00
qa Windows Support: Testing Suite integration 2022-03-17 09:01:01 -07:00
templates Update copyright year to 2022 2022-01-14 22:50:21 -08:00
setup-env.csh Update copyright year to 2022 2022-01-14 22:50:21 -08:00
setup-env.fish Update copyright year to 2022 2022-01-14 22:50:21 -08:00
setup-env.sh Update copyright year to 2022 2022-01-14 22:50:21 -08:00
setup-tutorial-env.sh Update copyright year to 2022 2022-01-14 22:50:21 -08:00
spack-completion.bash spack info: make sections optional; add build/stand-alone test information (#22097) 2022-03-28 22:15:38 +00:00