Hi, I've been using the envTemplate tag policy with the {{.DIGEST}} tag in the dev profile of my skaffold.yaml file.
skaffold run -p dev would run successfully when I was using Skaffold version v0.37.0, but now that I've upgraded to Skaffold version v0.38.0 I can see from the logs that tagging images with {{.DIGEST}}, {{.DIGEST_ALGO}} and {{.DIGEST_HEX}} have been officially deprecated(?).
I have been searching around the documentation to find out what is the proper replacement for {{.DIGEST}} and I haven't found anything.
Could someone point me in the right direction in regards to what the best practices are for using tag policies with helm deployments?
Generating tags...
- org/serviceA -> FATA[0000] failed to build: generating tag for org/serviceA: {{.DIGEST}}, {{.DIGEST_ALGO}} and {{.DIGEST_HEX}} are deprecated, image digest will now automatically be appended to image tags
v0.38.0apiVersion: skaffold/v1beta2
kind: Config
build:
artifacts:
- image: org/serviceA
context: .
docker: {}
tagPolicy:
envTemplate:
template: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}:{{.VERSION}}'
local: {}
deploy:
kubectl: {}
profiles:
- name: dev
build:
tagPolicy:
envTemplate:
template: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}:{{.DIGEST}}'
local: {}
deploy:
helm:
releases:
- name: serviceA
chartPath: charts/serviceA
setValueTemplates:
image.repository: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}'
image.tag: '{{.DIGEST}}'
skaffold run -p dev@KDvu Sorry for the confusion. I have brought this to our team's attention and we will definitely do a better job around documenting such deprecation in the release notes.
First off, looks like your config is very old.
skaffold fix to upgrade to latest version.overwrite flag mentioned here https://skaffold.dev/docs/references/cli/#skaffold-fixDIGEST from the dev profile and else.Let me know this fixes your problem.
@tejal29 Thank you for your help.
I applied your suggested actions and it fixed my problem.
skaffold fix --overwrite command updated the apiversion from v1beta2 to v1beta14.{{.DIGEST}} from the tagpolicy now causes the skaffold run -p dev command to successfully execute.I want to add that although my problem was fixed, I had another problem which was figuring out how to use the new docker image produced by skaffold run -p dev.
$ skaffold run -p dev
...
Build complete in 7.982785624s
Starting test...
Test complete in 12.029碌s
Tags used in deployment:
- org/serviceA -> docker_registry/org/serviceA@sha256:46ddfeca4f857f940a1ac9557bec7c154badf5ec6bc996c0b7309cc0d8af8bd4
Starting deploy...
I wanted to overwrite the values of the image.repository and image.tag keys in my values.yaml file to the repository + tag shown in the example above. If I couldn't do so then my Pods wouldn't be able to fetch and use the new image.
I did some playing around and noticed I could still use {{.DIGEST}} in the setValueTemplates block and the value of {{.DIGEST}} was docker_registry/org/serviceA@sha256:46ddfeca4f857f940a1ac9557bec7c154badf5ec6bc996c0b7309cc0d8af8bd4. The new docker image produced by skaffold run -p dev (shown in logs above), which is exactly what I was looking for.
This is my final working skaffold.yaml file
# skaffold.yaml
apiVersion: skaffold/v1beta14
kind: Config
build:
artifacts:
- image: org/serviceA
context: .
docker: {}
tagPolicy:
envTemplate:
template: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}:{{.VERSION}}'
local: {}
deploy:
kubectl: {}
profiles:
- name: dev
build:
tagPolicy:
envTemplate:
template: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}'
local: {}
deploy:
helm:
releases:
- name: serviceA
chartPath: charts/serviceA
setValueTemplates:
image.repository: '{{.DIGEST}}'
I'm happy to close this issue now. Unless you want to keep it open?
Thanks for the explanation!
Most helpful comment
@tejal29 Thank you for your help.
I applied your suggested actions and it fixed my problem.
skaffold fix --overwritecommand updated theapiversionfromv1beta2tov1beta14.{{.DIGEST}}from thetagpolicynow causes theskaffold run -p devcommand to successfully execute.I want to add that although my problem was fixed, I had another problem which was figuring out how to use the new docker image produced by
skaffold run -p dev.I wanted to overwrite the values of the
image.repositoryandimage.tagkeys in myvalues.yamlfile to the repository + tag shown in the example above. If I couldn't do so then my Pods wouldn't be able to fetch and use the new image.I did some playing around and noticed I could still use
{{.DIGEST}}in thesetValueTemplatesblock and the value of{{.DIGEST}}wasdocker_registry/org/serviceA@sha256:46ddfeca4f857f940a1ac9557bec7c154badf5ec6bc996c0b7309cc0d8af8bd4. The new docker image produced byskaffold run -p dev(shown in logs above), which is exactly what I was looking for.This is my final working
skaffold.yamlfileI'm happy to close this issue now. Unless you want to keep it open?