-
Notifications
You must be signed in to change notification settings - Fork 54
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
Test/scripts: add scripts for convenient download of image build CI cache (HMS-5356) #1155
Conversation
dbdff22
to
559cd98
Compare
I'm opening this PR for review, because the cache downloading part for osbuild manifest-tests is IMO sufficient, e.g. see https://gitlab.com/redhat/services/products/image-builder/ci/osbuild/-/jobs/8911649202 |
two minor questions:
|
559cd98
to
7576acc
Compare
First of all, thanks for having a look at the code.
Each script does fundamentally a different thing before downloading anything from the S3 cache, as described in the PR description. Personally, I disagree with the statement that there is a lot of duplicate code. The shared parts are in the
The reason is consistency with other Python scripts in the directory. |
Add a helper function to get the distro of the common CI runner. Signed-off-by: Tomáš Hozza <[email protected]>
Add a new `dl_build_cache()` function, for convenient download of all or just a specific files from the image build S3 cache. The function is based on `dl_build_info()`, which now just calls `dl_build_cache()`. Signed-off-by: Tomáš Hozza <[email protected]>
Add a script for downloading the current image build cache files from the S3 store. This script will be used for manifest builds in the osbuild repository, replacing manifest-db. Signed-off-by: Tomáš Hozza <[email protected]>
Add a script for downloading a specific image build cache based on a provided build info file. This is useful for downloading specific image artifacts from S3 after one already downloaded the image build metadata and do it without regenerating manifests. Signed-off-by: Tomáš Hozza <[email protected]>
7576acc
to
5646558
Compare
I prefer executable scripts with hashbangs not having extensions. I find it's cleaner for directly executable files to not need to advertise the language they're written in. I don't know if this is a controversial topic (quick searching around suggests it might be), but that was my original thinking when writing these. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff. TY. LGTM!
Add scripts for downloading image build CI cache to test osbuild behavior when rebuilding manifests in the osbuild repository (so-called manifest tests).
As I worked on using these scripts in the osbuild repo for manifest tests, I realized that there is a need to be able to split the test cases (corresponding to specific manifest) into batches to allow parallelization. For this reason, it is desirable to determine the current CI cache to download (which includes generating relevant manifests to determine their checksum), but don't download any image artifacts. The reason is that these are huge, and if traffic is not an issue, it still takes time to download files, which would not be used at all. Image artifacts are downloaded once test cases for the given batch are determined.
Instead of adding an overly complex script to handle both scenarios described above, I decided to split them and add two scripts (naming ideas are welcomed 😇):
dl-image-build-cache
script will determine the image build cache S3 paths based on the current branch of the images repository and download the image build cache files. Determining the S3 paths involves generating manifests for the relevant distro/arch/image_type/config combinations to determine manifest checksums. The script, by default, downloads only image build metadata (*.json
files, but mainlyinfo.json
) and the manifest. It can optionally download also image artifacts. While the reworked manifest tests in osbuild do not use this functionality, I kept it there in the hope that it may be helpful for manual downloads.dl-one-image-build-cache
script reads a single image build metadata (info.json
) and downloads all corresponding files.So the idea of the manifest tests (as implemented in osbuild/osbuild#1983) is that it will:
dl-image-build-cache
with specific arguments without downloading all image artifacts.dl-one-image-build-cache
to download image artifacts for the selected test cases./jira-epic COMPOSER-2318
JIRA: HMS-5356