Open
Description
Expected behavior
I'm trying to create a skaffold.yaml
config to be reused among multiple projects. Right now, the only blocker is inability to set build.artifacts.image
via a template variable, like so:
apiVersion: skaffold/v2beta28
kind: Config
build:
artifacts:
- image: &name "{{.PROJECT}}"
jib:
project: *name
deploy:
helm:
releases:
- name: *name
chartPath: helm
artifactOverrides:
image: *name
which could work from a project directory using something like
PROJECT=$(basename $PWD) skaffold dev -f ../skaffold.yaml
Actual behavior
Instead, since template variables are not understood in build.artifacts.*.image
, we have to either
- hard-code the image name and thus have a separate copy of
skaffold.yaml
for each individual project, or - use an external template substitution tool, for example
envsubst
orgomplate
to pre-processskaffold.yaml
, like so:
PROJECT=$(basename $PWD) envsubst <../skaffold.yaml | skaffold dev -f -
Otherwise, Skaffold complains with a message like invalid image "{{.PROJECT}}": invalid reference format
.
We cannot use --default-repo
with a generic image
for this use case either, since other values in the template depend on the image name and must be unique per-project (and they don't support {{.IMAGE_NAME}}
either).
Information
- Skaffold version:
v1.38.0
- Operating system:
MacOS 12.4
- Installed via: Homebrew Google Cloud SDK
- Contents of skaffold.yaml: please see above
Steps to reproduce the behavior
- Create a Skaffold config similar to the above, with template variables in
build.artifacts.*.image
- Use any Skaffold command with it
- Observe that template variables are not understood in
build.artifacts.*.image