CustomManager seems to have a problem adding a github SHA hash to the end of a number-only Docker tag #32665
Replies: 1 comment 5 replies
-
Hi there, This issue or discussion is missing some logs, making it difficult or impossible to help you. Depending on which situation applies follow one, some or all of these instructions. No logs at allIf you haven't posted any log yet, we need you to find and copy/paste the log into the issue template. Finding logs on hosted appSelect me to read instructionsIf you use the Mend Renovate app (GitHub):
Finding logs when self-hostingSelect me to read instructionsRead the Renovate docs, troubleshooting, self-hosted to learn how to find the logs. Insufficient logsSelect me to read instructionsIf you already gave us a log, and the Renovate team said it's not enough, then follow the instructions from the No logs at all section. Formatting your logsSelect me to read instructionsPlease put your logs in a
If you feel the logs are too large to paste here, please use a service like GitHub Gist and paste the link here. Good luck, The Renovate team |
Beta Was this translation helpful? Give feedback.
-
How are you running Renovate?
Self-hosted Renovate
If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.
GHE 38.80.0
Please tell us more about your question or problem
Hello all,
I have a file here "/path/to/var.json" with the following contents:
The
MY_IMAGE_TAG
is a hardcoded name and is not the name of the actual package. The actual package name ismy.docker.repo/my-org/my_awesome_test_image
from which the123
tag is also generated.I want to update the tag
"MY_IMAGE_TAG": 123
whenever there is a new Docker image built formy.docker.repo/my-org/my_awesome_test_image
.Some more details that makes this trickier. Our docker images are tagged in two ways. The first way is just an incremental number tag which is what is currently used by
vars.json
:123
,124
,125
, ...The second way is the incremental number tag with the Git commit SHA:
123-087d744d1d9e14c34c3bd8741b6b6ecb200bb434
124-027aba0471fc48727089d65282f61a4f3a388b09
...
We don't use the standard sha256 digest and I cannot change that.
I want to update the tag
"MY_IMAGE_TAG": 123
whenever there is a new Docker image built formy.docker.repo/my-org/my_awesome_test_image
using the "tag-SHA" format. Since Renovate doesn't have a manager out of the box for this, I tried creating my owncustomManagers
:I took some inspiration from prior art: #32085
I also tried
"extractVersionTemplate": "(?<version>\\d+)(?:-\\w{40})?"
but that caused Renovate to skip this file entirely.The problem I'm seeing right now is that Renovate finds the newer tag
124-027aba0471fc48727089d65282f61a4f3a388b09
, but is not able to update the tag123
for some reason, possibly because it doesn't conform to theallowedVersions
that I have defined in thepackageRules
?The
allowedVersions
is important because we have other Dockerfiles that use this config to update the tag+SHA so I cannot remove it either.Ideally, Renovate can update the
vars.json
with new tags using the "tag+SHA" format.Update 1:
I played with the config some more and now I'm able to get PRs with the correct tag+sha format. However, the problem now is it is not being surrounded by
"
, which causes the JSON to be invalid.So the diff looks something like:
but I want it to be like:
I thought updating the
autoReplaceStringTemplate
with\"
would've done the trick but apparently not.Logs (if relevant)
Logs
Beta Was this translation helpful? Give feedback.
All reactions