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
Shouldn't default-repo be applied to cacheFrom directives? #3610
Comments
@lucasmpr, thank you filing this issue. IIUC, Now you want to use the built image as That would mean, skaffold have to see if images in |
Hello tejal, let me explain a little bit more what I'm trying to do. a) I have one big repo with multiple services. I have a global dockerfile that does the following:
What I'm doing is a workaround for the "Dependent images" from #889 Then I want to build all the projects in parallel. So the idea is the following. I'm running skaffold 3 times.
piVersion: skaffold/v2alpha2
kind: Config
build:
local:
useBuildkit: false
concurrency: 0
artifacts:
- image: project1
context: .
docker:
dockerfile: Dockerfile.default
buildArgs:
PROJECT: Project1
cacheFrom:
- default-repo/base:latest
- default-repo/restore:latest
- default-repo/project1-cache:latest
- image: Project2
context: .
docker:
dockerfile: Dockerfile.default
buildArgs:
PROJECT: Project2
cacheFrom:
- default-repo/base:latest
- default-repo/restore:latest
- default-repo/project2-cache:latest
tagPolicy:
gitCommit:
variant: AbbrevCommitSha
profiles:
- name: restore-stage
build:
local:
useBuildkit: false
concurrency: 0
artifacts:
- image: restore
context: .
docker:
dockerfile: Dockerfile.default
cacheFrom:
- default-repo/restore:latest
target: pre_publish
buildArgs:
BUILDKIT_INLINE_CACHE: 1
- image: base
context: .
docker:
dockerfile: Dockerfile.default
cacheFrom:
- default-repo/base:latest
target: base
buildArgs:
BUILDKIT_INLINE_CACHE: 1
- name: cache-stage
build:
local:
useBuildkit: false
concurrency: 0
artifacts:
- image: project1-cache
context: .
docker:
dockerfile: Dockerfile.default
target: dependency_builder
buildArgs:
PROJECT: 'Project1'
cacheFrom:
- default-repo/base:latest
- default-repo/restore:latest
- default-repo/web-cache:latest
- image: project2-cache
context: .
docker:
dockerfile: Dockerfile.default
target: dependency_builder
buildArgs:
PROJECT: 'Project2'
cacheFrom:
- default-repo/base:latest
- default-repo/restore:latest
- default-repo/api-cache:latest I'm running it on google cloud with the following command:
What I expected was that if I dont type default-repo in the skaffold.yaml the cache from gets rewritten with my gcr.io/$PROJECT_ID/$BRANCH_NAME so my master branch always get the cache from my latest master branch, and when I'm building in another branch, it uses a previous branch. |
I think this makes sense. I'm going to bump the priority a little |
bumping the priority again, I think we should try and get to this in the next few milestones. if anyone is interested in helping out here, it would be appreciated :) |
I think |
This is nearing SLO and was wondering if anyone one is interested in taking this. |
We also need this one. Let me describe the use case here.
So it make perfectly sense to build base and have the 2 others cacheFrom the base (and node image as well). For now it's failing because of this issue. Another way to do this could also tu support variables expansion in skaffold.yaml which could have numerous other use cases but if skaffold checks for cacheFrom image in default repo before checking docker hub this is also fine to me. |
Any updates on this? I've got a use-case where we use the same skaffold file in different environments with their own registry. We can't realistically use caching without the default repo passing through. (As above... variable expansion would solve it too and my last resort is pre-processing my skaffold.yaml - please no!) |
bumping this up |
I'm trying very hard to optimize my DotNet multi-stage build process.
To do that I'm creating three profiles that I must execute in sequence.
Profile 1 - Base images
Profile 2 - Dependency Builder
Profile 3 - Final builder
The idea is to use caching and don't rebuild the whole system every time, and build in parallel things that are not dependent on others.
For each step, I want to use a previous image in cache or the image build in the latest profile. So was trying to use cacheFrom when I stumbled into that.
I use the --default-repo to set the image according to the branch, in runtime, and I expected the cache image to be pulled from my default repo, but It doesn't seem to be.
Additional
Expected behavior
If default-repo is specified, cacheFrom images without full path should be rewriten if not fully qualified.
Actual behavior
Skaffold says the image could not be found.
Information
The text was updated successfully, but these errors were encountered: