Skip to content

Commit

Permalink
test: share cache between jobs and pipelines
Browse files Browse the repository at this point in the history
The test cache holds the RPM metadata for depsolving (rpmmd) and a local
copy of the build info from s3.  Caching it and sharing it between jobs
should speed up config generation.
  • Loading branch information
achilleas-k committed Oct 24, 2023
1 parent d70266b commit e6526c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ check-build-coverage:
script:
- apk add -U go python3 gpgme-dev s3cmd
- ./test/scripts/check-build-coverage ./s3configs/
cache:
key: testcache
paths:
- .cache/osbuild-images

finish:
stage: finish
Expand Down
18 changes: 14 additions & 4 deletions test/scripts/configure-generators
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ generate-build-config-{distro}-{arch}:
artifacts:
paths:
- build-config.yml
cache:
key: testcache
paths:
- {cache}
"""

TRIGGER_TEMPLATE = """
Expand Down Expand Up @@ -69,6 +73,10 @@ generate-ostree-build-config-{distro}-{arch}:
- build-configs
needs:
- image-build-trigger-{distro}-{arch}
cache:
key: testcache
paths:
- {cache}
"""

OSTREE_TRIGGER_TEMPLATE = """
Expand All @@ -89,6 +97,8 @@ def main():
images = testlib.list_images(arches=ARCHITECTURES)
combos = set()

cache = testlib.TEST_CACHE_ROOT

gen_stage = []
trigger_stage = []
ostree_gen_stage = []
Expand All @@ -99,10 +109,10 @@ def main():
continue

combos.add(combo)
gen_stage.append(GEN_TEMPLATE.format(distro=img["distro"], arch=img["arch"]))
trigger_stage.append(TRIGGER_TEMPLATE.format(distro=img["distro"], arch=img["arch"]))
ostree_gen_stage.append(OSTREE_GEN_TEMPLATE.format(distro=img["distro"], arch=img["arch"]))
ostree_trigger_stage.append(OSTREE_TRIGGER_TEMPLATE.format(distro=img["distro"], arch=img["arch"]))
gen_stage.append(GEN_TEMPLATE.format(distro=img["distro"], arch=img["arch"], cache=cache))
trigger_stage.append(TRIGGER_TEMPLATE.format(distro=img["distro"], arch=img["arch"], cache=cache))
ostree_gen_stage.append(OSTREE_GEN_TEMPLATE.format(distro=img["distro"], arch=img["arch"], cache=cache))
ostree_trigger_stage.append(OSTREE_TRIGGER_TEMPLATE.format(distro=img["distro"], arch=img["arch"], cache=cache))

with open(config_path, "w", encoding="utf-8") as config_file:
config_file.write(BASE_CONFIG)
Expand Down

0 comments on commit e6526c2

Please sign in to comment.