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>
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!
Most helpful comment
@nathkn Any chance to clarify a bit further the approach that worked for you?