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

Add possibility to specify images to cache #575

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

valentyn-red-bird
Copy link

No description provided.

Copy link
Contributor

@Kurt-von-Laven Kurt-von-Laven left a comment

Choose a reason for hiding this comment

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

This is a good concept and has the backing of multiple previous independent feature requests. Admittedly those were already addressed by filtering out pre-existing images, but in any case I am sold on this feature being worthy of inclusion at this point. Let me know if you need any help addressing the issues detected by CI after taking a look at our contributing guide. You will be able to address the security vulnerabilities simply by rebasing.

description: >
If "all", all images will be included.
Otherwise, specify precisely all needed images to be included separated with spaces.
required: true
Copy link
Contributor

Choose a reason for hiding this comment

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

I may be missing something, but I think this should be false since, when not specified, the default behavior ought to be the behavior that predates this PR.

@@ -29,6 +29,8 @@ const loadDockerImages = async (): Promise<void> => {

const saveDockerImages = async (): Promise<void> => {
const key = getInput("key", { required: true });
const includedImages = getInput("included-images", { required: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see the rationale for specifying this argument as required.

(image: string): boolean => !preexistingImages.includes(image)
(image: string): boolean =>
!preexistingImages.includes(image) &&
includedImagesList.includes(image)
Copy link
Contributor

Choose a reason for hiding this comment

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

To pass CI/CR, you will need test coverage for the (currently unhandled) case where the default value is passed as well as the case where it is overridden by the user. I think users will find it counter-intuitive if pre-existing images are still filtered out when they specified explicitly what to cache.

Comment on lines +59 to +60
info("newImagesArgs");
info(newImagesArgs);
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this left over from debugging? execBashCommand already logs the command passed to it, which contains this string.

@@ -11,6 +11,12 @@ inputs:
are not supported, because partial cache restoration leads to a "snowball"
effect.
required: true
included-images:
description: >
If "all", all images will be included.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would change the default to "new" and clarify that we, to quote the README: "filter out Docker images that are present before the action is run, notably those pre-cached by GitHub actions; only save Docker images pulled or built in the same job after the action is run." I don't see much reason to support "all" unless we get some use case for that from folks using self-hosted runners that aren't pre-caching Docker images.

@@ -11,6 +11,12 @@ inputs:
are not supported, because partial cache restoration leads to a "snowball"
effect.
required: true
included-images:
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the proposed name. Just gotta document it in the README too.

@@ -11,6 +11,12 @@ inputs:
are not supported, because partial cache restoration leads to a "snowball"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit (commit message): the scope should be "action" rather than "ci" since "ci" within this repository would refer to the CI pipeline for this action itself. (In fairness, this action is run as part of its own CI... he he.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants