GoogleContainerTools/skaffold

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

Open

#3,610 建立於 2020年1月29日

在 GitHub 查看
 (9 留言) (7 反應) (0 負責人)Go (12,822 star) (1,416 fork)batch import
area/cachehelp wantedkind/bugpriority/p2

描述

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:
profile:
- name: restore-stage
  build:
    local: 
      useBuildkit: false
    artifacts:
    - image: restore
      context: .
      docker:
        dockerfile: Dockerfile.default
        cacheFrom:
        - restore:latest
        target: pre_publish

貢獻者指南