From 87b8321fa948b906a285406c5ea79e33258386d1 Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Fri, 1 Jul 2022 12:56:36 -0600 Subject: gitlab: Fix pipeline generation for non-develop protected pipelines (#31378) Release branches and tags run protected pipelines, and we noticed that those pipelines were generating all jobs in the stack, even when the mirror contained all the built specs and an up to date index. The problem was caused because the override mirror was not present in spacks mirror configuration at the time when the binary_distribution.update() method was called. This fixes that by always adding the mirror override, if present, to the list of configured mirrors. --- lib/spack/spack/ci.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py index 254821cb3d..d600e69c42 100644 --- a/lib/spack/spack/ci.py +++ b/lib/spack/spack/ci.py @@ -771,9 +771,13 @@ def generate_gitlab_ci_yaml(env, print_summary, output_file, mirrors_to_check = { 'override': remote_mirror_override } - else: - spack.mirror.add( - 'ci_pr_mirror', remote_mirror_override, cfg.default_modify_scope()) + + # If we have a remote override and we want generate pipeline using + # --check-index-only, then the override mirror needs to be added to + # the configured mirrors when bindist.update() is run, or else we + # won't fetch its index and include in our local cache. + spack.mirror.add( + 'ci_pr_mirror', remote_mirror_override, cfg.default_modify_scope()) pipeline_artifacts_dir = artifacts_root if not pipeline_artifacts_dir: @@ -819,7 +823,7 @@ def generate_gitlab_ci_yaml(env, print_summary, output_file, user_artifacts_dir, ci_project_dir) # Speed up staging by first fetching binary indices from all mirrors - # (including the per-PR mirror we may have just added above). + # (including the override mirror we may have just added above). try: bindist.binary_index.update() except bindist.FetchCacheError as e: @@ -853,8 +857,7 @@ def generate_gitlab_ci_yaml(env, print_summary, output_file, finally: # Clean up remote mirror override if enabled if remote_mirror_override: - if spack_pipeline_type != 'spack_protected_branch': - spack.mirror.remove('ci_pr_mirror', cfg.default_modify_scope()) + spack.mirror.remove('ci_pr_mirror', cfg.default_modify_scope()) all_job_names = [] output_object = {} -- cgit v1.2.3-70-g09d2