Add support for image.digest
#444
Reference in New Issue
Block a user
No description provided.
Delete Branch "refs/pull/444/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
fix #398
Thanks for implementing this. Could you add tests to ensure correct rendering behavior with/without digest?
@justusbunsi Waiting for your review after having added a test.
this will fail with message like:
on
gitea-inline-config
configmap - it should be truncated or just use the tag (kube v1.27)The idea is to only use the digest and no tag, see the respective test for it. In your case then
gitea/gitea@sha256:1b75efb0e3b2ac7ac62a786cbb0a48ca2c89f0b80c3ff7b435f55b4aa10744ec
.You can add the tag information as a comment alongside the value.
anyway it will fail according to the https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
in that case digest have 71 characters so it will not be a valid label value
Thanks for the persistence! I think the simplest way is that we just trim the resulting label to 63 chars. The full digest is still visible in the image reference.
@pat-s Happy to talk about my comments below. :)
@ -34,4 +48,3 @@
{{/*
Create chart name and version as used by the chart label.
*/}}
I guess you mentioned it somewhere; don't know where exactly. I've noticed you adapted the Bitnami functionality1. What is the benefit for leaving out the image tag and only use the digest? It somehow makes it less obvious which image version is actually used.
Do you have objections against combining tag and digest in the image reference?
https://github.com/bitnami/charts/blob/main/bitnami/common/templates/_images.tpl#L6 ↩︎
I agree. I thought it might help with the length discussion initially but then again this only occurs for
labels
and not fortag
. Hence I agree the tag should be kept!@ -81,7 +91,7 @@ imagePullSecrets:
Storage Class
*/}}
The whole
define "gitea.labels"
part can be reverted to its pre-PR state. The if conditions are now more or less identical. The only change between if and else is thetrunc 63
of the image tag (appVersion), which is not longer than 63 characters. This was only the case for.Values.image.digest
.Agree.
Based on the outcome of the "combining tag and digest in the image reference" conversation, we probably should add more test cases to cover the correct templating behavior for
gitea.image
helper function. It kinda looks prone to future 🐛s due to its complexity. If you want, I can add tests for that to the branch when the mentioned conversation is resolved. I didn't wanted to add changes without asking you.Agree. Feel free to go ahead! I think tests for all "only tag", "tag + digest" and "only digest" would be great.
@pat-s I updated the PR branch to match the current main state.
Based on our review comment conversations, I...
Anything you want to add, change or discuss?
Thanks for continueing! It fell off my list a bit...
And was anyhow targeted towards you 😄
All good for me.
🎉 Let's goooo
@justusbunsi by merging with upstream you have removed commit
d9188bfe2a
I use
renovate
for automatic update of images and it doesn't supportdigest
parameter. My values looks likeSo the
version
is not trimmed and the labels are too long.@mmalyska
The removal/restore was intentional, because with the digest field, there is no need (from the chart perspective) to specify the digest in tag field. So it won't be too long for labels.
I was sure there is a built-in way for renovate to look up the digest field instead. I need to check this.
For now you could use regex manager and let the docker datasource update your image spec. This will work.
Hrm. Couldn't find what I had in mind. Looks like extracting from digest field would be a neat addition to the helm-values manager in Renovate.
Anyway, you can use the regex manager for that use case.
@mmalyska Out of interest: why are you using a digest when you already referring to a fixed tag? Tags like 1.20.4 are not going to change ever, they are not rebuilt. Only rolling tags like
:1
or1.20
are.@justusbunsi Given our custom setup here in this chart, we might want to add some instructions to the README how to make it work with the renovate regex manager? You might already use it?
I use pinning digest as tags are not immutable in docker(they are just shortcuts for digests). In my whole solution I use the same approach for all deployed apps(renovate pinning digests). To be safe that the image will never change you are required to pin the digest of image.
This is example of my regex manager for gitea that replaces digest https://github.com/mmalyska/home-ops/blob/main/.github/renovate/regexmanager.json5
@pat-s I've create PR with updated README https://gitea.com/gitea/helm-chart/pulls/514
I am aware but I still don't understand the "fear" behind it. So far I thought there must be "something different" than the irrational fear of a tag changing the image content without one noticing it. But I think I understood it now, thanks for the explanation.
And thanks for the PR!