skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

Skaffold image filter with -build-image does not work properly with requires.

Open gaurav0107 opened this issue 3 years ago • 6 comments

Expected behavior skaffold build -p test -b IMAGE2 should build IMAGE2 along with IMAGE1 as dependency

Actual behavior

Here is a sample skaffold in which, I only want to build IMAGE2, thus I use skaffold build -p test -b IMAGE2 but since image2 is dependent on image 1 this filter stops build 2 as well since it cannot find build 1 throwing an error

FATA[0034] failed to resolve build result for required artifact "IMAGE1" subtask=-1 task=DevLoop

Information

  • Skaffold version: v1.35.6
  • Operating system: MacOS Contents of ~/.skaffold/config:
apiVersion: skaffold/v2beta26
kind: Config
profiles:
- name: test
  build:
    tagPolicy:
      envTemplate:
        template: latest
    artifacts:
    - image: IMAGE1
      custom:
        buildCommand: echo "Bulding image 1"
    - image: IMAGE2
      custom:
        buildCommand: echo "Building image 2"
      requires:
      - image: IMAGE1
    - image: IMAGE3
      custom:
        buildCommand: echo "Building image 3"

gaurav0107 avatar Jan 25 '22 10:01 gaurav0107

@gaurav0107 Please take a look at https://skaffold.dev/docs/tutorials/artifact-dependencies/ to see how to specify artifact dependencies. Looking at your config, it does not look like you are using the requires stanza.

/cc Adding @gsquared94

tejal29 avatar Jan 26 '22 16:01 tejal29

@tejal29 even if I use the exact same example and build via

skaffold build -b app since app requires base but its not in -b filter, it gives error as

FATA[0005] failed to resolve build result for required artifact "base" subtask=-1 task=DevLoop

apiVersion: skaffold/v2beta9
kind: Config
build:
  artifacts:
  - image: app
    context: app
    requires:
    - image: base
      alias: BASE
  - image: base
    context: base

gaurav0107 avatar Jan 27 '22 05:01 gaurav0107

ah got it thanks. I will add the bug label and add it our planning.

tejal29 avatar May 09 '22 18:05 tejal29

Hello,

Got the same annoying bug here.

In my case, i would like to push IMAGE2 but not IMAGE1. I don't see how to do that :(

I tried:

skaffold build -b IMAGE1
skaffold build -b IMAGE2 --push

but I got the same error failed to resolve build result for required artifact

greenmaid avatar Sep 20 '22 09:09 greenmaid

Any updates on this?

kamalezz-telus avatar Jan 15 '24 20:01 kamalezz-telus

Any updates on this? Fairly frustrating that skaffold dev is the only way to actually test this capability and can not instrument particular artifacts.

allidoisace avatar Apr 11 '24 23:04 allidoisace