Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix buildcache sync so we can always run protected-publish #38866

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

scottwittenburg
Copy link
Contributor

@scottwittenburg scottwittenburg commented Jul 12, 2023

This PR makes some improvements to the spack buildcache sync command, configures the protected-publish job to trust the public reputational signing key (and ensure sync'd binaries have been signed with it), and sets the protected-publish job to run always instead of only on_success.

Motivation

Spack pipelines rely on this command in the protected-publish job, a final pipeline job (scheduled in protected pipelines only) which runs after all stack-specific child pipelines have completed. The goal of the job is to copy any specs rebuilt in the pipeline from stack-specific mirrors to the root.

Until now, this job only ran when all the child pipelines succeeded, but this is causing the top-level mirror to be missing a lot of specs. By making the spack buildcache sync command more resilient to certain kinds of errors, we will be able to configure the protected-publish job to run always.

The essential modifications are the following: The command should only sync buildcache entries which are signed with a trusted key. This way, if any sign-pkgs jobs fail, we don't end up with binaries at the top-level which are still signed with the intermediate signing key. Also, if any of the rebuild jobs in a pipeline fail to produce the files listed in the manifest, the command should gracefully ignore those, and continue copying valid, properly signed binaries on a best-effort basis.

Specific improvements to the spack buildcache sync command

  • Provide --only-verified option to only copy buildcache entries whose signature can be verified
  • Remove logic allowing to provide local_path to the copy_buildcache_file method, as it didn't have the intended effect but added complication
  • Remove .spec.yaml files from the list of metadata files to look for
  • When copying metadata files, try first the .spec.json.sig file, and only if that fails, try a .spec.json file
  • When copying metadata files, if no metadata file is successfully transferred (because it doesn't exist, or because you asked for --only-verified and the signature could not be verified), then skip copying the archive file
  • Add test logic to exercise the new --only-verfied option (as well as the --manifest-glob option which was previously untested)
  • Add type hints and better docstrings to changed methods

@spackbot-app spackbot-app bot added commands core PR affects Spack core functionality gitlab Issues related to gitlab integration tests General test capability(ies) labels Jul 12, 2023
@scottwittenburg scottwittenburg force-pushed the improve-buildcache-sync branch 2 times, most recently from bb2fdf4 to 0d8de58 Compare July 12, 2023 21:32
@scottwittenburg
Copy link
Contributor Author

Here's a simulated develop pipeline exercising this: https://gitlab.spack.io/scott/pipeline-experiments/-/pipelines/443891

Provide option to only sync buildcache entries that are properly
signed.  Also, gracefully ignore any entries from the manifest
that did not get created created in the pipeline.  Add tests of
new and previously untested code paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commands core PR affects Spack core functionality gitlab Issues related to gitlab integration tests General test capability(ies)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants