-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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: cache test images for integration
, VM
and module
tests
#7599
Changes from 5 commits
c75cead
49461b0
208edcd
620ca42
c015645
0609e5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -82,6 +82,26 @@ jobs: | |||||||||
with: | ||||||||||
aqua_version: v1.25.0 | ||||||||||
|
||||||||||
- name: Generate image list digest | ||||||||||
id: image-digest | ||||||||||
run: | | ||||||||||
IMAGE_LIST=$(skopeo list-tags docker://ghcr.io/aquasecurity/trivy-test-images) | ||||||||||
DIGEST=$(echo "$IMAGE_LIST" | sha256sum | cut -d' ' -f1) | ||||||||||
echo "digest=$DIGEST" >> $GITHUB_OUTPUT | ||||||||||
|
||||||||||
- name: Restore test images from cache | ||||||||||
uses: actions/cache@v4 | ||||||||||
id: restore-test-images | ||||||||||
with: | ||||||||||
path: integration/testdata/fixtures/images | ||||||||||
key: cache-test-images-${{ steps.image-digest.outputs.digest }} | ||||||||||
restore-keys: | ||||||||||
cache-test-images- | ||||||||||
|
||||||||||
- name: Download test images | ||||||||||
if: steps.restore-test-images.outputs.cache-hit != 'true' | ||||||||||
knqyf263 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
run: mage test:fixtureContainerImages | ||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this step anymore. It is transparently called. Line 277 in bbc8e1d
And it's efficient as it skips images if it exists locally. Lines 30 to 32 in bbc8e1d
Now, we call this check twice, which is just time-consuming (and API-consuming). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, since the cache will still be saved at the end of the job! Removed |
||||||||||
- name: Run integration tests | ||||||||||
run: mage test:integration | ||||||||||
|
||||||||||
|
@@ -122,6 +142,26 @@ jobs: | |||||||||
with: | ||||||||||
aqua_version: v1.25.0 | ||||||||||
|
||||||||||
- name: Generate image list digest | ||||||||||
id: image-digest | ||||||||||
run: | | ||||||||||
IMAGE_LIST=$(skopeo list-tags docker://ghcr.io/aquasecurity/trivy-test-images) | ||||||||||
DIGEST=$(echo "$IMAGE_LIST" | sha256sum | cut -d' ' -f1) | ||||||||||
echo "digest=$DIGEST" >> $GITHUB_OUTPUT | ||||||||||
|
||||||||||
- name: Restore test images from cache | ||||||||||
uses: actions/cache@v4 | ||||||||||
id: restore-test-images | ||||||||||
with: | ||||||||||
path: integration/testdata/fixtures/images | ||||||||||
key: cache-test-images-${{ steps.image-digest.outputs.digest }} | ||||||||||
restore-keys: | ||||||||||
cache-test-images- | ||||||||||
|
||||||||||
- name: Download test images | ||||||||||
if: steps.restore-test-images.outputs.cache-hit != 'true' | ||||||||||
run: mage test:fixtureContainerImages | ||||||||||
|
||||||||||
- name: Run module integration tests | ||||||||||
shell: bash | ||||||||||
run: | | ||||||||||
|
@@ -142,6 +182,27 @@ jobs: | |||||||||
uses: aquaproj/[email protected] | ||||||||||
with: | ||||||||||
aqua_version: v1.25.0 | ||||||||||
|
||||||||||
- name: Generate image list digest | ||||||||||
id: image-digest | ||||||||||
run: | | ||||||||||
IMAGE_LIST=$(skopeo list-tags docker://ghcr.io/aquasecurity/trivy-test-vm-images) | ||||||||||
DIGEST=$(echo "$IMAGE_LIST" | sha256sum | cut -d' ' -f1) | ||||||||||
echo "digest=$DIGEST" >> $GITHUB_OUTPUT | ||||||||||
|
||||||||||
- name: Restore test VM images from cache | ||||||||||
uses: actions/cache@v4 | ||||||||||
id: restore-test-vm-images | ||||||||||
with: | ||||||||||
path: integration/testdata/fixtures/vm-images | ||||||||||
key: cache-test-vm-images-${{ steps.image-digest.outputs.digest }} | ||||||||||
restore-keys: | ||||||||||
cache-test-vm-images- | ||||||||||
|
||||||||||
- name: Download test VM images | ||||||||||
if: steps.restore-test-vm-images.outputs.cache-hit != 'true' | ||||||||||
run: mage test:fixtureVMImages | ||||||||||
|
||||||||||
- name: Run vm integration tests | ||||||||||
run: | | ||||||||||
mage test:vm | ||||||||||
|
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.
nit: We no longer need
id
.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.
We want to merge this PR soon. We can delete it later.