diff --git a/lib/config/presets/internal/regex-managers.ts b/lib/config/presets/internal/regex-managers.ts index 55494a3f95a9f3..fc06068f942434 100644 --- a/lib/config/presets/internal/regex-managers.ts +++ b/lib/config/presets/internal/regex-managers.ts @@ -26,4 +26,16 @@ export const presets: Record = { }, ], }, + helmChartYamlAppVersions: { + description: 'Update `appVersion` value in Helm chart Chart.yaml.', + regexManagers: [ + { + datasourceTemplate: 'docker', + fileMatch: ['(^|/)Chart\\.yaml$'], + matchStrings: [ + '#\\s*renovate: image=(?.*?)\\s+appVersion:\\s*["\']?(?[\\w+\\.\\-]*)', + ], + }, + ], + }, }; diff --git a/lib/modules/manager/regex/readme.md b/lib/modules/manager/regex/readme.md index 3d267bb9e76b83..a4a0ab618557b4 100644 --- a/lib/modules/manager/regex/readme.md +++ b/lib/modules/manager/regex/readme.md @@ -128,9 +128,41 @@ This is because Handlebars escapes special characters with double braces (by def By adding `renovate: datasource=` and `depName=` comments to the `Dockerfile` you only need _one_ `regexManager` instead of _four_. The `Dockerfile` is documented better as well. -The syntax in the example is arbitrary and you can set your own syntax. +The syntax in the example is arbitrary, and you can set your own syntax. If you do, update your `matchStrings` regex! +You can use simple versions of such comments to increase readability. + +For example the `appVersion` property in a `Chart.yaml` of a Helm chart is always referenced to an Docker image. +In such scenarios, some values can be hard-coded. +For example: + +```yaml +apiVersion: v2 +name: amazon-eks-pod-identity-webhook +description: A Kubernetes webhook for pods that need AWS IAM access +version: 1.0.3 +type: application +# renovate: image=amazon/amazon-eks-pod-identity-webhook +appVersion: 'v0.4.0' +``` + +Using the `regexManagers` below, Renovate looks for available Docker tags of the image `amazon/amazon-eks-pod-identity-webhook`. + +```json +{ + "regexManagers": [ + { + "datasourceTemplate": "docker", + "fileMatch": ["(^|/)Chart\\.yaml$"], + "matchStrings": [ + "#\\s?renovate: image=(?.*?)\\s?appVersion:\\s?\\\"?(?[\\w+\\.\\-]*)\"" + ] + } + ] +} +``` + ### Using regexManager to update the dependency name in addition to version #### Updating `gitlab-ci include` dep names