GoogleContainerTools / GoogleContainerTools/skaffold

Artifact dependencies don't work if a default value is set

Open
#5,943 3 comments 0 reactions 0 assignees View on GitHub
area/build feature/artifact-dependencies kind/feature-request priority/p3
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

Following https://skaffold.dev/docs/tutorials/artifact-dependencies/ we can define a base image dependency as a build argument.
Unfortunately this mechanism doesn't work if a default value is specified to the build argument, as the default argument takes precedence over the skaffold assignment.
Having a default value is useful in my case because the images are also built on testing pipelines that don't include Skaffold.
There are workarounds but the behaviour was unexpected and was leading to subtle bugs in our deployment because of unupdated images.

### Expected behavior
Expecting Skaffold to override the default build argument

### Actual behavior
The default build argument value takes precedence and the Skaffold dependencies mechanism get broken.
Works as expected if no default value is provided

### Information

- Skaffold version: tested with v1.20.0, spec v2beta11
- Operating system: tested on linux/ubuntu
- Contents of skaffold.yaml:

https://github.com/GoogleContainerTools/skaffold/tree/master/examples/simple-artifact-dependency

### Steps to reproduce the behavior

1. https://github.com/GoogleContainerTools/skaffold/tree/master/examples/simple-artifact-dependency
2. Change app/Dockerfile first line to use a default like `ARG BASE=mydefaultvalue`
2. `skaffold dev`

Output:
```
Listing files to watch...
- app
listing files: parsing ONBUILD instructions: retrieving image "mydefaultvalue": GET https://index.docker.io/v2/library/mydefaultvalue/manifests/latest: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:library/mydefaultvalue Type:repository]]
```

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.