Skaffold: {{.IMAGE_NAME}} has no value after successful build w/ buildCommand

Created on 19 Feb 2020  路  5Comments  路  Source: GoogleContainerTools/skaffold

Doing something like the below yields a helm release name w/ <no value> which is illegal for helm.

The image tag that is created/pushed successfully before helm is invoked is: 56a66ce-dirty, so I would expect {{.IMAGE_NAME}} to have this value but it doesn't.

My buildCommand below generates a dockerfile, builds, tags and pushes to a private registry w/ a tag that is equal to the value generated by the declared tagPolicy of AbbrevCommitSha

apiVersion: skaffold/v2alpha3
kind: Config
metadata:
  name: my-testapp
build:
  artifacts:
    - image: registry.mydomain.com/my/my-testapp
      custom: 
        buildCommand: ./gen-tag-push-image.sh -f dockerhub.mydomain.com/my/my-base-image:3.3.0-0--1-1 --tagwithgitcommitid --build --tagpush

  tagPolicy:
    gitCommit:
      variant: AbbrevCommitSha  # git describe --match=NeVeRmAtCh --always --abbrev=7 --dirty

deploy:
  helm:
    releases:
      - name: "{{.IMAGE_NAME}}"
        chartPath: bitsofinfo-appdeploy/appdeploy
        remote: true
        version: 1.1.14
        wait: true
        namespace: my-apps

        valuesFiles:
          - /path/to/values/defaults/values.yaml
          - /path/to/values/stage/values.yaml

        setValueTemplates:
          image.tag: "{{.IMAGE_NAME}}"
          replicaCount: 2

https://github.com/GoogleContainerTools/skaffold/issues/3549

aredeploy deplohelm kinbug prioritp3

All 5 comments

Related to #3343

This sounds fixable. Help wanted!

3343 added IMAGE_REPO and IMAGE_TAG. It seems that IMAGE_NAME isn't available in the helm deployer even though it's mentioned in our documentation. The workaround for now would be to use "{{.IMAGE_REPO}}:{{.IMAGE_TAG}}"

the lack of variables everywhere applied with consistency is sorely lacking in general.

you should be able to cross reference any other part of the yaml in any value.

Agree with the sentiment that skaffold's treatment of helm gets inconsistent in a few places and we definitely rely on the more experienced community members to help us identify and fix them.
I tried to investigate the code for this specific issue of helm release names not supporting image name templates like IMAGE_NAME, IMAGE_REPO, etc. It seems to have been deliberate so as not to break skaffold delete which doesn't take the built images and as such cannot construct back the helm release name.
If you have a different idea than helm delete <release_name> for doing the cleanup that we currently do then let us know.

I'll add an issue to rewrite the documentation around templating support and behavior in helm so it's not left for the users to guess.

Was this page helpful?
0 / 5 - 0 ratings