Skip to content

Commit

Permalink
feat(presets/regex): Add preset for appVersion in helm charts (#19371)
Browse files Browse the repository at this point in the history
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
  • Loading branch information
5 people committed Jan 16, 2023
1 parent 3c98fc0 commit 2c70a5d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/config/presets/internal/regex-managers.ts
Expand Up @@ -26,4 +26,16 @@ export const presets: Record<string, Preset> = {
},
],
},
helmChartYamlAppVersions: {
description: 'Update `appVersion` value in Helm chart Chart.yaml.',
regexManagers: [
{
datasourceTemplate: 'docker',
fileMatch: ['(^|/)Chart\\.yaml$'],
matchStrings: [
'#\\s*renovate: image=(?<depName>.*?)\\s+appVersion:\\s*["\']?(?<currentValue>[\\w+\\.\\-]*)',
],
},
],
},
};
34 changes: 33 additions & 1 deletion lib/modules/manager/regex/readme.md
Expand Up @@ -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=(?<depName>.*?)\\s?appVersion:\\s?\\\"?(?<currentValue>[\\w+\\.\\-]*)\""
]
}
]
}
```

### Using regexManager to update the dependency name in addition to version

#### Updating `gitlab-ci include` dep names
Expand Down

0 comments on commit 2c70a5d

Please sign in to comment.