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

Allow caching from built artifact on local Docker build #6904

Conversation

artemkoru
Copy link
Contributor

Fixes #6809

It's the same as PR, now for local Docker builder.

Description
Cause Docker cacheFrom references to the artifact image (which is untagged) to be replaced with the tagged image (possibly affected by the default-repo).

For example:

build:
  artifacts:
  - image: skaffold-example
    docker:
      cacheFrom:
      - skaffold-example
      - gcr.io/k8s-skaffold/skaffold-example:latest # used if the tagged image is not found

Allow disabling by setting SKAFFOLD_DISABLE_DOCKER_CACHE_ADJUSTMENT in the environment.

Note: Docker image caching is a bit complex, and this StackOverflow answer provides helpful details.

User facing changes (remove if N/A)

  • Local Docker builds can cache from the previous build by including the artifact image in the cacheFrom.

cc: @briandealwis

@artemkoru artemkoru requested a review from a team as a code owner November 24, 2021 09:19
@artemkoru artemkoru requested a review from nkubala November 24, 2021 09:19
@google-cla google-cla bot added the cla: no label Nov 24, 2021
@artemkoru
Copy link
Contributor Author

I have just signed the Contributor License Agreement. Pls rerun the CLA check.

@google-cla google-cla bot added cla: yes and removed cla: no labels Nov 29, 2021
Copy link
Member

@briandealwis briandealwis left a comment

Choose a reason for hiding this comment

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

Thanks!

@briandealwis briandealwis added the kokoro:run runs the kokoro jobs on a PR label Dec 1, 2021
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Dec 1, 2021
@briandealwis briandealwis enabled auto-merge (squash) December 1, 2021 16:14
@codecov
Copy link

codecov bot commented Dec 1, 2021

Codecov Report

Merging #6904 (c50294b) into main (290280e) will decrease coverage by 1.41%.
The diff coverage is 61.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6904      +/-   ##
==========================================
- Coverage   70.48%   69.07%   -1.42%     
==========================================
  Files         515      547      +32     
  Lines       23150    25096    +1946     
==========================================
+ Hits        16317    17334    +1017     
- Misses       5776     6588     +812     
- Partials     1057     1174     +117     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/deploy.go 52.00% <ø> (-1.85%) ⬇️
cmd/skaffold/app/cmd/dev.go 84.61% <0.00%> (ø)
cmd/skaffold/app/cmd/flags.go 91.00% <0.00%> (+0.18%) ⬆️
cmd/skaffold/app/cmd/render.go 36.66% <0.00%> (-4.72%) ⬇️
cmd/skaffold/skaffold.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/inspect_tests.go 62.50% <14.28%> (-1.14%) ⬇️
cmd/skaffold/app/cmd/fix.go 68.85% <40.00%> (-7.62%) ⬇️
cmd/skaffold/app/cmd/lint.go 42.85% <42.85%> (ø)
cmd/skaffold/app/cmd/find_configs.go 48.88% <50.00%> (+0.24%) ⬆️
cmd/skaffold/app/skaffold.go 76.19% <70.00%> (-8.43%) ⬇️
... and 164 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e95e61...c50294b. Read the comment docs.

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

Successfully merging this pull request may close these issues.

Local docker builder should support using the previously built image as a cache source
3 participants