GoogleContainerTools / GoogleContainerTools/skaffold

Shouldn't default-repo be applied to cacheFrom directives?

Open
#3,610 9 comments 7 reactions 0 assignees View on GitHub
area/cache help wanted kind/bug priority/p2
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

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
------------
+ I would like to be able to use templating in the cacheFrom directive, so I can use the previous image and not necessarly the one tagged as latest.

### 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

- Skaffold version: 1.2.0
- Operating system: Windows
- Contents of skaffold.yaml:

```yaml
profile:
- name: restore-stage
build:
local:
useBuildkit: false
artifacts:
- image: restore
context: .
docker:
dockerfile: Dockerfile.default
cacheFrom:
- restore:latest
target: pre_publish

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.