Skaffold: Allow helm deploy to get the value of the generated tag

Created on 31 Aug 2018  路  3Comments  路  Source: GoogleContainerTools/skaffold

I would like my the helm deploy configuration to be able to overwrite a value in my values.yaml file to the generated tag so I could make use of it in my helm chart.

Currently I'm able to extract the image name with the appended tag, but I was unable to find any functionality to extract the appended tag separate from the image name.

so a skaffold.yaml that looks something like this:

apiVersion: skaffold/v1alpha2
kind: Config
build:
  tagPolicy:
    gitCommit: {}  
  artifacts:
  - imageName: test-app
    workspace: ../
  local:
    skipPush: true
deploy:
  helm:
    releases:
    - name: test-app
      chartPath: test-app
      namespace: test-app
      valuesFilePath: test-app/values.yaml
      values:
        image: test-app
        tag: <some reference to the tag>

Most helpful comment

@nathkn Any chance to clarify a bit further the approach that worked for you?

All 3 comments

I found a simpler solution by modifying the _helpers.tpl file for the chart, so I'll close the issue:

{{/*
Get the image tag.
*/}}
{{- define "test-app.tag" -}}
{{- .Values.image | splitList ":" | last -}}
{{- end -}}

@nathkn Any chance to clarify a bit further the approach that worked for you?

@quentusrex the _helpers.tpl is a functions file for helm charts.
The function @nathkn suggests is create a variable based on the values key image we add while using skaffold. after you have this variable you can use it in helm templates files.

In my case i replaced {{ .Values.deployment.image.tag }} with {{ include "test-app.tag" }}.

@nathkn thanks for the solution!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GeertJohan picture GeertJohan  路  3Comments

rahulwa picture rahulwa  路  4Comments

kdevu picture kdevu  路  3Comments

garvincasimir picture garvincasimir  路  4Comments

strikeout picture strikeout  路  4Comments