Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(presets/regex): Add preset for appVersion in helm charts #19371

Merged
merged 10 commits into from
Jan 16, 2023
12 changes: 12 additions & 0 deletions lib/config/presets/internal/regex-managers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,16 @@ export const presets: Record<string, Preset> = {
},
],
},
helmChartYamlAppVersions: {
description: 'Update `appVersion` value in helm chart Chart.yaml.',
jkroepke marked this conversation as resolved.
Show resolved Hide resolved
regexManagers: [
{
datasourceTemplate: 'docker',
fileMatch: ['(^|/)Chart\\.yaml$'],
matchStrings: [
'#\\s?renovate: image=(?<depName>.*?)\\s?appVersion:\\s?\\"?(?<currentValue>[\\w+\\.\\-]*)',
jkroepke marked this conversation as resolved.
Show resolved Hide resolved
],
},
],
},
};
33 changes: 32 additions & 1 deletion lib/modules/manager/regex/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,40 @@ 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!

Simplified version of such comments can be used to increase to readability.
jkroepke marked this conversation as resolved.
Show resolved Hide resolved

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:
jkroepke marked this conversation as resolved.
Show resolved Hide resolved

```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 will look for available docker tag of the image `amazon/amazon-eks-pod-identity-webhook`.
jkroepke marked this conversation as resolved.
Show resolved Hide resolved

```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