Skip to content

Commit 84100af

Browse files
Pipelines: use shared pr mirror for pipeline generation and builds (spack#25529)
Once PR binary graduation is deployed, the shared PR mirror will contain binaries just built by a merged PR, before the subsequent develop pipeline has had time to finish. Using the shared PR mirror as a source of binaries will reduce the number of times we have to rebuild the same full hash.
1 parent 37e4d32 commit 84100af

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lib/spack/spack/ci.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
]
4646

4747
SPACK_PR_MIRRORS_ROOT_URL = 's3://spack-binaries-prs'
48+
SPACK_SHARED_PR_MIRROR_URL = url_util.join(SPACK_PR_MIRRORS_ROOT_URL,
49+
'shared_pr_mirror')
4850
TEMP_STORAGE_MIRROR_NAME = 'ci_temporary_mirror'
4951

5052
spack_gpg = spack.main.SpackCommand('gpg')
@@ -612,11 +614,14 @@ def generate_gitlab_ci_yaml(env, print_summary, output_file,
612614
'strip-compilers': False,
613615
})
614616

615-
# Add this mirror if it's enabled, as some specs might be up to date
616-
# here and thus not need to be rebuilt.
617+
# Add per-PR mirror (and shared PR mirror) if enabled, as some specs might
618+
# be up to date in one of those and thus not need to be rebuilt.
617619
if pr_mirror_url:
618620
spack.mirror.add(
619621
'ci_pr_mirror', pr_mirror_url, cfg.default_modify_scope())
622+
spack.mirror.add('ci_shared_pr_mirror',
623+
SPACK_SHARED_PR_MIRROR_URL,
624+
cfg.default_modify_scope())
620625

621626
pipeline_artifacts_dir = artifacts_root
622627
if not pipeline_artifacts_dir:

lib/spack/spack/test/cmd/ci.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ def test_ci_generate_for_pr_pipeline(tmpdir, mutable_mock_env_path,
617617
os.environ['SPACK_PR_BRANCH'] = 'fake-test-branch'
618618
monkeypatch.setattr(
619619
ci, 'SPACK_PR_MIRRORS_ROOT_URL', r"file:///fake/mirror")
620+
monkeypatch.setattr(
621+
ci, 'SPACK_SHARED_PR_MIRROR_URL', r"file:///fake/mirror_two")
620622
try:
621623
ci_cmd('generate', '--output-file', outputfile)
622624
finally:
@@ -668,6 +670,8 @@ def test_ci_generate_with_external_pkg(tmpdir, mutable_mock_env_path,
668670
with ev.read('test'):
669671
monkeypatch.setattr(
670672
ci, 'SPACK_PR_MIRRORS_ROOT_URL', r"file:///fake/mirror")
673+
monkeypatch.setattr(
674+
ci, 'SPACK_SHARED_PR_MIRROR_URL', r"file:///fake/mirror_two")
671675
ci_cmd('generate', '--output-file', outputfile)
672676

673677
with open(outputfile) as f:
@@ -1153,6 +1157,8 @@ def test_ci_generate_override_runner_attrs(tmpdir, mutable_mock_env_path,
11531157
spack.main, 'get_version', lambda: '0.15.3-416-12ad69eb1')
11541158
monkeypatch.setattr(
11551159
ci, 'SPACK_PR_MIRRORS_ROOT_URL', r"file:///fake/mirror")
1160+
monkeypatch.setattr(
1161+
ci, 'SPACK_SHARED_PR_MIRROR_URL', r"file:///fake/mirror_two")
11561162
ci_cmd('generate', '--output-file', outputfile)
11571163

11581164
with open(outputfile) as f:
@@ -1257,6 +1263,8 @@ def test_ci_generate_with_workarounds(tmpdir, mutable_mock_env_path,
12571263
with ev.read('test'):
12581264
monkeypatch.setattr(
12591265
ci, 'SPACK_PR_MIRRORS_ROOT_URL', r"file:///fake/mirror")
1266+
monkeypatch.setattr(
1267+
ci, 'SPACK_SHARED_PR_MIRROR_URL', r"file:///fake/mirror_two")
12601268
ci_cmd('generate', '--output-file', outputfile, '--dependencies')
12611269

12621270
with open(outputfile) as f:
@@ -1417,6 +1425,8 @@ def fake_get_mirrors_for_spec(spec=None, full_hash_match=False,
14171425
with ev.read('test'):
14181426
monkeypatch.setattr(
14191427
ci, 'SPACK_PR_MIRRORS_ROOT_URL', r"file:///fake/mirror")
1428+
monkeypatch.setattr(
1429+
ci, 'SPACK_SHARED_PR_MIRROR_URL', r"file:///fake/mirror_two")
14201430

14211431
ci_cmd('generate', '--output-file', outputfile)
14221432

@@ -1568,6 +1578,8 @@ def test_ci_generate_temp_storage_url(tmpdir, mutable_mock_env_path,
15681578

15691579
monkeypatch.setattr(
15701580
ci, 'SPACK_PR_MIRRORS_ROOT_URL', r"file:///fake/mirror")
1581+
monkeypatch.setattr(
1582+
ci, 'SPACK_SHARED_PR_MIRROR_URL', r"file:///fake/mirror_two")
15711583

15721584
with ev.read('test'):
15731585
ci_cmd('generate', '--output-file', outputfile)

0 commit comments

Comments
 (0)