Skip to content
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: split save and restore cache actions #7614

Merged

Conversation

DmitriyLewen
Copy link
Contributor

@DmitriyLewen DmitriyLewen commented Sep 30, 2024

Description

Split save and restore cache actions:

  • use actions/cache/restore in tests.
  • use actions/cache in new cache-test-images.yaml workflow.

test runs:

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

run: mage test:fixtureContainerImages

- name: Generate image list digest
if: github.ref == 'refs/heads/main'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
if: github.ref == 'refs/heads/main'
if: github.ref_name == 'main'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use go-version for security patches in the release workflow, but I think we can use go-version-file for this workflow.

Suggested change
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also thought about this.
Updated in 91a8016

with:
aqua_version: v1.25.0

- name: Download test images
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should restore cache before this step. Otherwise, it downloads images every time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 91a8016

We use restore and save actions, so we can use actions/cache in this workflow.

@@ -0,0 +1,80 @@
name: Cache test images
on:
workflow_dispatch:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to add schedule.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do this job once a day?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's start with daily. Most images are unchanged, and we don't call GHCR API other than listing tags.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 91a8016

@DmitriyLewen DmitriyLewen marked this pull request as ready for review September 30, 2024 09:13
@DmitriyLewen DmitriyLewen added this pull request to the merge queue Sep 30, 2024
Merged via the queue into aquasecurity:main with commit cb16d43 Sep 30, 2024
14 checks passed
@DmitriyLewen DmitriyLewen deleted the ci/split-save-and-restore-cache branch September 30, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants