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

chore: change custom actions pull logic, to check if an image exists locally first before triggering a pull #9147

Merged

Conversation

renzodavid9
Copy link
Contributor

@renzodavid9 renzodavid9 commented Oct 23, 2023

Fixes: #9139

Description
This PR adds a new config field for local custom actions to force the use of a local image if one exists, if it doesn't exists it will trigger a pull.

How to test the change
With the following skaffold.yaml file:

apiVersion: skaffold/v4beta8
kind: Config

customActions:
  - name: my-action
    executionMode:
      local:
        useLocalImages: true
    containers:
      - name: gcloud-task
        image: gcr.io/cloud-builders/gcloud:latest
        command: ["/bin/sh"]
        args: ["-c", "gcloud version"]

Execute skaffold exec my-action. You'll notice that the image is pull from the registry before running the container. Now if you run skaffold exec my-action again, you'll see that Skaffold is not trying to pull the image again from the registry.

Follow-up work
#9148: We'll be adding the same logic for skaffold verify, the schema change affects both, customActions, and verify.

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #9147 (4d30132) into main (290280e) will decrease coverage by 7.13%.
Report is 1048 commits behind head on main.
The diff coverage is 48.33%.

❗ Current head 4d30132 differs from pull request most recent head 183fcba. Consider uploading reports for the commit 183fcba to get more accurate results

@@            Coverage Diff             @@
##             main    #9147      +/-   ##
==========================================
- Coverage   70.48%   63.35%   -7.13%     
==========================================
  Files         515      630     +115     
  Lines       23150    32419    +9269     
==========================================
+ Hits        16317    20540    +4223     
- Misses       5776    10314    +4538     
- Partials     1057     1565     +508     
Files Coverage Δ
cmd/skaffold/app/cmd/commands.go 97.61% <100.00%> (+0.35%) ⬆️
cmd/skaffold/app/cmd/config.go 100.00% <100.00%> (ø)
cmd/skaffold/app/cmd/config/list.go 65.21% <ø> (ø)
cmd/skaffold/app/cmd/config/set.go 88.72% <ø> (ø)
cmd/skaffold/app/cmd/config/util.go 54.28% <ø> (ø)
cmd/skaffold/app/cmd/credits.go 100.00% <ø> (ø)
cmd/skaffold/app/cmd/debug.go 100.00% <100.00%> (ø)
cmd/skaffold/app/cmd/flags.go 93.00% <100.00%> (+2.18%) ⬆️
cmd/skaffold/app/cmd/generate_pipeline.go 60.00% <ø> (ø)
cmd/skaffold/app/cmd/init.go 100.00% <100.00%> (ø)
... and 41 more

... and 434 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@renzodavid9 renzodavid9 marked this pull request as ready for review October 23, 2023 20:09
Copy link
Contributor

@aaron-prindle aaron-prindle left a comment

Choose a reason for hiding this comment

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

LGTM!

@renzodavid9 renzodavid9 merged commit 8d20ed0 into GoogleContainerTools:main Oct 24, 2023
12 checks passed
@renzodavid9 renzodavid9 deleted the custom-actions-cache branch October 24, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Custom Actions] New config option to check images in local host before pull
2 participants