diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index 754a53e2b98191..7658749dac56e8 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -646,176 +646,480 @@ When using with `npm`, we recommend you: ## customDatasources Use `customDatasources` to fetch releases from APIs or statically hosted sites and Renovate has no own datasource. -These datasources can be referred by RegexManagers or can be used to overwrite default datasources. +These datasources can be referred by `customManagers` or can be used to overwrite default datasources. For more details see the [`custom` datasource documentation](/modules/datasource/custom/). -## customizeDashboard - -You can use the `customizeDashboard` object to customize dependency dashboard. - -Supported fields: +## customManagers -- `repoProblemsHeader`: This field will replace the header of the Repository Problems in dependency dashboard issue. +Use `customManagers`(previously `regexManagers`) entries to configure the custom managers in Renovate. -### defaultRegistryUrlTemplate +You can define custom managers to handle: -`registryUrl` which is used, if none is return by extraction. -As this is a template it can be dynamically set. E.g. add the `packageName` as part of the URL: +- Proprietary file formats or conventions +- Popular file formats not yet supported as a manager by Renovate -```json5 -{ - customDatasources: { - foo: { - defaultRegistryUrlTemplate: 'https://exmaple.foo.bar/v1/{{ packageName }}', - }, - }, -} -``` +Currently we only have one custom manager. +The `regex` manager which is based on using Regular Expression named capture groups. -### format +You must have a named capture group matching (e.g. `(?.*)`) _or_ configure its corresponding template (e.g. `depNameTemplate`) for these fields: -Defines which format the API is returning. -Currently `json` or `plain` are supported, see the `custom` [datasource documentation](/modules/datasource/custom/) for more information. +- `datasource` +- `depName` +- `currentValue` -### transformTemplates +Use named capture group matching _or_ set a corresponding template. +We recommend you use only _one_ of these methods, or you'll get confused. -`transformTemplates` is a list of [jsonata rules](https://docs.jsonata.org/simple) which get applied serially. -Use this if the API does not return a Renovate compatible schema. +We recommend that you also tell Renovate what `versioning` to use. +If the `versioning` field is missing, then Renovate defaults to using `semver` versioning. -## defaultRegistryUrls +For more details and examples about it, see our [documentation for the `regex` manager](/modules/manager/regex/). +For template fields, use the triple brace `{{{ }}}` notation to avoid Handlebars escaping any special characters. -Override a datasource's default registries with this config option. -The datasources's `customRegistrySupport` value must be `true` for the config option to work. + +!!! tip + Look at our [Regex Manager Presets](https://docs.renovatebot.com/presets-regexManagers/), they may have what you need. -Default registries are only used when both: +### customType -- The manager did not extract any `registryUrls` values, and -- No `registryUrls` values have been applied via config, such as `packageRules` +Example: -Think of `defaultRegistryUrls` as a way to specify the "fallback" registries for a datasource, for use when no `registryUrls` are extracted or configured. -Compare that to `registryUrls`, which are a way to _override_ registries. +```json +{ + "customManagers": [ + { + "customType": "regex", + "matchStrings": [ + "ENV .*?_VERSION=(?.*) # (?.*?)/(?.*?)\\s" + ] + } + ] +} +``` -## dependencyDashboard +### matchStrings -Starting from version `v26.0.0` the "Dependency Dashboard" is enabled by default as part of the commonly-used `config:recommended` preset. +Each `matchStrings` must be a valid regular expression, optionally with named capture groups. -To disable the Dependency Dashboard, add the preset `:disableDependencyDashboard` or set `dependencyDashboard` to `false`. +Example: ```json { - "extends": ["config:recommended", ":disableDependencyDashboard"] + "matchStrings": [ + "ENV .*?_VERSION=(?.*) # (?.*?)/(?.*?)\\s" + ] } ``` -Configuring `dependencyDashboard` to `true` will lead to the creation of a "Dependency Dashboard" issue within the repository. -This issue has a list of all PRs pending, open, closed (unmerged) or in error. -The goal of this issue is to give visibility into all updates that Renovate is managing. +### matchStringsStrategy -Examples of what having a Dependency Dashboard will allow you to do: +`matchStringsStrategy` controls behavior when multiple `matchStrings` values are provided. +Three options are available: -- View all PRs in one place, rather than having to filter PRs by author -- Rebase/retry multiple PRs without having to open each individually -- Override any rate limiting (e.g. concurrent PRs) or scheduling to force Renovate to create a PR that would otherwise be suppressed -- Recreate an unmerged PR (e.g. for a major update that you postponed by closing the original PR) +- `any` (default) +- `recursive` +- `combination` - -!!! tip - Enabling the Dependency Dashboard by itself does _not_ change the "control flow" of Renovate. - Renovate still creates and manages PRs, and still follows your schedules and rate limits. - The Dependency Dashboard gives you extra visibility and control over your updates. +#### any -## dependencyDashboardApproval +Each provided `matchString` will be matched individually to the content of the `packageFile`. +If a `matchString` has multiple matches in a file each will be interpreted as an independent dependency. -This feature allows you to use Renovate's Dependency Dashboard to force approval of updates before they are created. +As example the following configuration will update all three lines in the Dockerfile. +renovate.json: -By setting `dependencyDashboardApproval` to `true` in config (including within `packageRules`), you can tell Renovate to wait for your approval from the Dependency Dashboard before creating a branch/PR. -You can approve a pending PR by selecting the checkbox in the Dependency Dashboard issue. +```json +{ + "customManagers": [ + { + "customType": "regex", + "fileMatch": ["^Dockerfile$"], + "matchStringsStrategy": "any", + "matchStrings": [ + "ENV [A-Z]+_VERSION=(?.*) # (?.*?)/(?.*?)(\\&versioning=(?.*?))?\\s", + "FROM (?\\S*):(?\\S*)" + ], + "datasourceTemplate": "docker" + } + ] +} +``` - -!!! tip - When you set `dependencyDashboardApproval` to `true` the Dependency Dashboard issue will be created automatically, you do not need to turn on `dependencyDashboard` explicitly. +A Dockerfile: -You can configure Renovate to wait for approval for: +```dockerfile +FROM amd64/ubuntu:18.04 +ENV GRADLE_VERSION=6.2 # gradle-version/gradle&versioning=maven +ENV NODE_VERSION=10.19.0 # github-tags/nodejs/node&versioning=node +``` -- all package upgrades -- major, minor, patch level upgrades -- specific package upgrades -- upgrades coming from specific package managers +#### recursive -If you want to approve _all_ upgrades, set `dependencyDashboardApproval` to `true`: +If using `recursive` the `matchStrings` will be looped through and the full match of the last will define the range of the next one. +This can be used to narrow down the search area to prevent multiple matches. +But the `recursive` strategy still allows the matching of multiple dependencies as described below. +All matches of the first `matchStrings` pattern are detected, then each of these matches will be used as basis for the input for the next `matchStrings` pattern, and so on. +If the next `matchStrings` pattern has multiple matches then it will split again. +This process will be followed as long there is a match plus a next `matchingStrings` pattern is available. + +Matched groups will be available in subsequent matching layers. + +This is an example how this can work. +The first custom manager will only upgrade `grafana/loki` as looks for the `backup` key then looks for the `test` key and then uses this result for extraction of necessary attributes. +But the second custom manager will upgrade both definitions as its first `matchStrings` matches both `test` keys. + +renovate.json: ```json { - "dependencyDashboardApproval": true + "customManagers": [ + { + "customType": "regex", + "fileMatch": ["^example.json$"], + "matchStringsStrategy": "recursive", + "matchStrings": [ + "\"backup\":\\s*{[^}]*}", + "\"test\":\\s*\\{[^}]*}", + "\"name\":\\s*\"(?.*)\"[^\"]*\"type\":\\s*\"(?.*)\"[^\"]*\"value\":\\s*\"(?.*)\"" + ], + "datasourceTemplate": "docker" + }, + { + "fileMatch": ["^example.json$"], + "matchStringsStrategy": "recursive", + "matchStrings": [ + "\"test\":\\s*\\{[^}]*}", + "\"name\":\\s*\"(?.*)\"[^\"]*\"type\":\\s*\"(?.*)\"[^\"]*\"value\":\\s*\"(?.*)\"" + ], + "datasourceTemplate": "docker" + } + ] } ``` -If you want to require approval for _major_ updates, set `dependencyDashboardApproval` to `true` within a `major` object: +example.json: ```json { - "major": { - "dependencyDashboardApproval": true + "backup": { + "test": { + "name": "grafana/loki", + "type": "docker", + "value": "1.6.1" + } + }, + "setup": { + "test": { + "name": "python", + "type": "docker", + "value": "3.9.0" + } } } ``` -If you want to approve _specific_ packages, set `dependencyDashboardApproval` to `true` within a `packageRules` entry where you have defined a specific package or pattern. +#### combination + +You may use this option to combine the values of multiple lines inside a file. +You can combine multiple lines with `matchStringStrategy` values, but the `combination` approach is less susceptible to white space or line breaks stopping a match. + +`combination` can only match _one_ dependency per file. +To update multiple dependencies with `combination` you must define multiple custom managers. + +Matched group values will be merged to form a single dependency. + +renovate.json: ```json { - "packageRules": [ + "customManagers": [ { - "matchPackagePatterns": ["^@package-name"], - "dependencyDashboardApproval": true + "customType": "regex", + "fileMatch": ["^main.yml$"], + "matchStringsStrategy": "combination", + "matchStrings": [ + "prometheus_image:\\s*\"(?.*)\"\\s*//", + "prometheus_version:\\s*\"(?.*)\"\\s*//" + ], + "datasourceTemplate": "docker" + }, + { + "fileMatch": ["^main.yml$"], + "matchStringsStrategy": "combination", + "matchStrings": [ + "thanos_image:\\s*\"(?.*)\"\\s*//", + "thanos_version:\\s*\"(?.*)\"\\s*//" + ], + "datasourceTemplate": "docker" } ] } ``` -## dependencyDashboardAutoclose +Ansible variable file (YAML): -You can configure this to `true` if you prefer Renovate to close an existing Dependency Dashboard whenever there are no outstanding PRs left. +```yaml +prometheus_image: "prom/prometheus" // a comment +prometheus_version: "v2.21.0" // a comment +------ +thanos_image: "prom/prometheus" // a comment +thanos_version: "0.15.0" // a comment +``` -## dependencyDashboardFooter +In the above example, each custom manager will match a single dependency each. -## dependencyDashboardHeader +### depNameTemplate -## dependencyDashboardLabels +If `depName` cannot be captured with a named capture group in `matchString` then it can be defined manually using this field. +It will be compiled using Handlebars and the regex `groups` result. -The labels only get updated when the Dependency Dashboard issue updates its content and/or title. -It is pointless to edit the labels, as Renovate bot restores the labels on each run. +### extractVersionTemplate -## dependencyDashboardOSVVulnerabilitySummary +If `extractVersion` cannot be captured with a named capture group in `matchString` then it can be defined manually using this field. +It will be compiled using Handlebars and the regex `groups` result. -Use this option to control if the Dependency Dashboard lists the OSV-sourced CVEs for your repository. -You can choose from: +### packageNameTemplate -- `none` (default) do not list any CVEs -- `unresolved` list CVEs that have no fixes -- `all` list all CVEs +`packageName` is used for looking up dependency versions. +It will be compiled using Handlebars and the regex `groups` result. +It will default to the value of `depName` if left unconfigured/undefined. -This feature is independent of the `osvVulnerabilityAlerts` option. +### currentValueTemplate -The source of these CVEs is [OSV.dev](https://osv.dev/). +If the `currentValue` for a dependency is not captured with a named group then it can be defined in config using this field. +It will be compiled using Handlebars and the regex `groups` result. -## dependencyDashboardTitle +### datasourceTemplate -Configure this option if you prefer a different title for the Dependency Dashboard. +If the `datasource` for a dependency is not captured with a named group then it can be defined in config using this field. +It will be compiled using Handlebars and the regex `groups` result. -## description +### depTypeTemplate -The description field can be used inside any configuration object to add a human-readable description of the object's config purpose. -Descriptions fields embedded within presets are also collated as part of the onboarding description. +If `depType` cannot be captured with a named capture group in `matchString` then it can be defined manually using this field. +It will be compiled using Handlebars and the regex `groups` result. -## digest +### versioningTemplate -Add to this object if you wish to define rules that apply only to PRs that update digests. +If the `versioning` for a dependency is not captured with a named group then it can be defined in config using this field. +It will be compiled using Handlebars and the regex `groups` result. -## draftPR +### registryUrlTemplate -If you want the PRs created by Renovate to be considered as drafts rather than normal PRs, you could add this property to your `renovate.json`: +If the `registryUrls` for a dependency is not captured with a named group then it can be defined in config using this field. +It will be compiled using Handlebars and the regex `groups` result. + +### autoReplaceStringTemplate + +Allows overwriting how the matched string is replaced. +This allows for some migration strategies. +E.g. moving from one Docker image repository to another one. + +`helm-values.yaml`: + +```yaml +# The image of the service //: +image: my.old.registry/aRepository/andImage:1.18-alpine +``` + +The regex definition: + +```json +{ + "customManagers": [ + { + "customType": "regex", + "fileMatch": ["values.yaml$"], + "matchStrings": [ + "image:\\s+(?my\\.old\\.registry/aRepository/andImage):(?[^\\s]+)" + ], + "depNameTemplate": "my.new.registry/aRepository/andImage", + "autoReplaceStringTemplate": "image: {{{depName}}}:{{{newValue}}}", + "datasourceTemplate": "docker" + } + ] +} +``` + +This will lead to following update where `1.21-alpine` is the newest version of `my.new.registry/aRepository/andImage`: + +```yaml +# The image of the service //: +image: my.new.registry/aRepository/andImage:1.21-alpine +``` + +## customizeDashboard + +You may use the `customizeDashboard` object to customize the Dependency Dashboard. + +Supported fields: + +- `repoProblemsHeader`: This field will replace the header of the Repository Problems in dependency dashboard issue. + +### defaultRegistryUrlTemplate + +This field is used to build a `registryUrl` for the dependency. +It is not needed if either: + +- The dependency can be found with the default `registryUrls` of the datasource (e.g. npmjs registry if the datasource is `npm`), or +- The matching groups you specified as part of the matching already include a `registryUrl` group + As this is a template it can be dynamically set. + E.g. add the `packageName` as part of the URL: + +```json5 +{ + customDatasources: { + foo: { + defaultRegistryUrlTemplate: 'https://exmaple.foo.bar/v1/{{ packageName }}', + }, + }, +} +``` + +### format + +Defines which format the API is returning. +Currently `json` or `plain` are supported, see the `custom` [datasource documentation](/modules/datasource/custom/) for more information. + +### transformTemplates + +`transformTemplates` is a list of [jsonata rules](https://docs.jsonata.org/simple) which get applied serially. +Use this if the API does not return a Renovate compatible schema. + +## defaultRegistryUrls + +Override a datasource's default registries with this config option. +The datasources's `customRegistrySupport` value must be `true` for the config option to work. + +Default registries are only used when both: + +- The manager did not extract any `registryUrls` values, and +- No `registryUrls` values have been applied via config, such as `packageRules` + +Think of `defaultRegistryUrls` as a way to specify the "fallback" registries for a datasource, for use when no `registryUrls` are extracted or configured. +Compare that to `registryUrls`, which are a way to _override_ registries. + +## dependencyDashboard + +Starting from version `v26.0.0` the "Dependency Dashboard" is enabled by default as part of the commonly-used `config:recommended` preset. + +To disable the Dependency Dashboard, add the preset `:disableDependencyDashboard` or set `dependencyDashboard` to `false`. + +```json +{ + "extends": ["config:recommended", ":disableDependencyDashboard"] +} +``` + +Configuring `dependencyDashboard` to `true` will lead to the creation of a "Dependency Dashboard" issue within the repository. +This issue has a list of all PRs pending, open, closed (unmerged) or in error. +The goal of this issue is to give visibility into all updates that Renovate is managing. + +Examples of what having a Dependency Dashboard will allow you to do: + +- View all PRs in one place, rather than having to filter PRs by author +- Rebase/retry multiple PRs without having to open each individually +- Override any rate limiting (e.g. concurrent PRs) or scheduling to force Renovate to create a PR that would otherwise be suppressed +- Recreate an unmerged PR (e.g. for a major update that you postponed by closing the original PR) + + +!!! tip + Enabling the Dependency Dashboard by itself does _not_ change the "control flow" of Renovate. + Renovate still creates and manages PRs, and still follows your schedules and rate limits. + The Dependency Dashboard gives you extra visibility and control over your updates. + +## dependencyDashboardApproval + +This feature allows you to use Renovate's Dependency Dashboard to force approval of updates before they are created. + +By setting `dependencyDashboardApproval` to `true` in config (including within `packageRules`), you can tell Renovate to wait for your approval from the Dependency Dashboard before creating a branch/PR. +You can approve a pending PR by selecting the checkbox in the Dependency Dashboard issue. + + +!!! tip + When you set `dependencyDashboardApproval` to `true` the Dependency Dashboard issue will be created automatically, you do not need to turn on `dependencyDashboard` explicitly. + +You can configure Renovate to wait for approval for: + +- all package upgrades +- major, minor, patch level upgrades +- specific package upgrades +- upgrades coming from specific package managers + +If you want to approve _all_ upgrades, set `dependencyDashboardApproval` to `true`: + +```json +{ + "dependencyDashboardApproval": true +} +``` + +If you want to require approval for _major_ updates, set `dependencyDashboardApproval` to `true` within a `major` object: + +```json +{ + "major": { + "dependencyDashboardApproval": true + } +} +``` + +If you want to approve _specific_ packages, set `dependencyDashboardApproval` to `true` within a `packageRules` entry where you have defined a specific package or pattern. + +```json +{ + "packageRules": [ + { + "matchPackagePatterns": ["^@package-name"], + "dependencyDashboardApproval": true + } + ] +} +``` + +## dependencyDashboardAutoclose + +You can configure this to `true` if you prefer Renovate to close an existing Dependency Dashboard whenever there are no outstanding PRs left. + +## dependencyDashboardFooter + +## dependencyDashboardHeader + +## dependencyDashboardLabels + +The labels only get updated when the Dependency Dashboard issue updates its content and/or title. +It is pointless to edit the labels, as Renovate bot restores the labels on each run. + +## dependencyDashboardOSVVulnerabilitySummary + +Use this option to control if the Dependency Dashboard lists the OSV-sourced CVEs for your repository. +You can choose from: + +- `none` (default) do not list any CVEs +- `unresolved` list CVEs that have no fixes +- `all` list all CVEs + +This feature is independent of the `osvVulnerabilityAlerts` option. + +The source of these CVEs is [OSV.dev](https://osv.dev/). + +## dependencyDashboardTitle + +Configure this option if you prefer a different title for the Dependency Dashboard. + +## description + +The description field can be used inside any configuration object to add a human-readable description of the object's config purpose. +Descriptions fields embedded within presets are also collated as part of the onboarding description. + +## digest + +Add to this object if you wish to define rules that apply only to PRs that update digests. + +## draftPR + +If you want the PRs created by Renovate to be considered as drafts rather than normal PRs, you could add this property to your `renovate.json`: ```json { @@ -3018,299 +3322,6 @@ You can select which behavior you want from Renovate: We recommend that you stick with the default setting for this option. Only change this setting if you really need to. -## regexManagers - -Use `regexManagers` entries to configure the `regex` manager in Renovate. - -You can define custom managers to handle: - -- Proprietary file formats or conventions -- Popular file formats not yet supported as a manager by Renovate - -The custom manager concept is based on using Regular Expression named capture groups. - -You must have a named capture group matching (e.g. `(?.*)`) _or_ configure its corresponding template (e.g. `depNameTemplate`) for these fields: - -- `datasource` -- `depName` -- `currentValue` - -Use named capture group matching _or_ set a corresponding template. -We recommend you use only one of these methods, or you'll get confused. - -We recommend that you also tell Renovate what `versioning` to use. -If the `versioning` field is missing, then Renovate defaults to using `semver` versioning. - -For more details and examples, see our [documentation for the `regex` manager](/modules/manager/regex/). -For template fields, use the triple brace `{{{ }}}` notation to avoid Handlebars escaping any special characters. - - -!!! tip - Look at our [Regex Manager Presets](https://docs.renovatebot.com/presets-regexManagers/), they may have what you need. - -### customType - -Example: - -```json -{ - "regexManagers": [ - { - "customType": "regex", - "matchStrings": [ - "ENV .*?_VERSION=(?.*) # (?.*?)/(?.*?)\\s" - ] - } - ] -} -``` - -### matchStrings - -`matchStrings` should each be a valid regular expression, optionally with named capture groups. - -Example: - -```json -{ - "matchStrings": [ - "ENV .*?_VERSION=(?.*) # (?.*?)/(?.*?)\\s" - ] -} -``` - -### matchStringsStrategy - -`matchStringsStrategy` controls behavior when multiple `matchStrings` values are provided. -Three options are available: - -- `any` (default) -- `recursive` -- `combination` - -#### any - -Each provided `matchString` will be matched individually to the content of the `packageFile`. -If a `matchString` has multiple matches in a file each will be interpreted as an independent dependency. - -As example the following configuration will update all 3 lines in the Dockerfile. -renovate.json: - -```json -{ - "regexManagers": [ - { - "fileMatch": ["^Dockerfile$"], - "matchStringsStrategy": "any", - "matchStrings": [ - "ENV [A-Z]+_VERSION=(?.*) # (?.*?)/(?.*?)(\\&versioning=(?.*?))?\\s", - "FROM (?\\S*):(?\\S*)" - ], - "datasourceTemplate": "docker" - } - ] -} -``` - -a Dockerfile: - -```dockerfile -FROM amd64/ubuntu:18.04 -ENV GRADLE_VERSION=6.2 # gradle-version/gradle&versioning=maven -ENV NODE_VERSION=10.19.0 # github-tags/nodejs/node&versioning=node -``` - -#### recursive - -If using `recursive` the `matchStrings` will be looped through and the full match of the last will define the range of the next one. -This can be used to narrow down the search area to prevent multiple matches. -But the `recursive` strategy still allows the matching of multiple dependencies as described below. -All matches of the first `matchStrings` pattern are detected, then each of these matches will used as basis be used as the input for the next `matchStrings` pattern, and so on. -If the next `matchStrings` pattern has multiple matches then it will split again. -This process will be followed as long there is a match plus a next `matchingStrings` pattern is available. - -Matched groups will be available in subsequent matching layers. - -This is an example how this can work. -The first regex manager will only upgrade `grafana/loki` as looks for the `backup` key then looks for the `test` key and then uses this result for extraction of necessary attributes. -But the second regex manager will upgrade both definitions as its first `matchStrings` matches both `test` keys. - -renovate.json: - -```json -{ - "regexManagers": [ - { - "fileMatch": ["^example.json$"], - "matchStringsStrategy": "recursive", - "matchStrings": [ - "\"backup\":\\s*{[^}]*}", - "\"test\":\\s*\\{[^}]*}", - "\"name\":\\s*\"(?.*)\"[^\"]*\"type\":\\s*\"(?.*)\"[^\"]*\"value\":\\s*\"(?.*)\"" - ], - "datasourceTemplate": "docker" - }, - { - "fileMatch": ["^example.json$"], - "matchStringsStrategy": "recursive", - "matchStrings": [ - "\"test\":\\s*\\{[^}]*}", - "\"name\":\\s*\"(?.*)\"[^\"]*\"type\":\\s*\"(?.*)\"[^\"]*\"value\":\\s*\"(?.*)\"" - ], - "datasourceTemplate": "docker" - } - ] -} -``` - -example.json: - -```json -{ - "backup": { - "test": { - "name": "grafana/loki", - "type": "docker", - "value": "1.6.1" - } - }, - "setup": { - "test": { - "name": "python", - "type": "docker", - "value": "3.9.0" - } - } -} -``` - -#### combination - -This option allows the possibility to combine the values of multiple lines inside a file. -While using multiple lines is also possible using both other `matchStringStrategy` values, the `combination` approach is less susceptible to white space or line breaks stopping a match. - -`combination` will only match at most one dependency per file, so if you want to update multiple dependencies using `combination` you have to define multiple regex managers. - -Matched group values will be merged to form a single dependency. - -renovate.json: - -```json -{ - "regexManagers": [ - { - "fileMatch": ["^main.yml$"], - "matchStringsStrategy": "combination", - "matchStrings": [ - "prometheus_image:\\s*\"(?.*)\"\\s*//", - "prometheus_version:\\s*\"(?.*)\"\\s*//" - ], - "datasourceTemplate": "docker" - }, - { - "fileMatch": ["^main.yml$"], - "matchStringsStrategy": "combination", - "matchStrings": [ - "thanos_image:\\s*\"(?.*)\"\\s*//", - "thanos_version:\\s*\"(?.*)\"\\s*//" - ], - "datasourceTemplate": "docker" - } - ] -} -``` - -Ansible variable file ( yaml ): - -```yaml -prometheus_image: "prom/prometheus" // a comment -prometheus_version: "v2.21.0" // a comment ------- -thanos_image: "prom/prometheus" // a comment -thanos_version: "0.15.0" // a comment -``` - -In the above example, each regex manager will match a single dependency each. - -### depNameTemplate - -If `depName` cannot be captured with a named capture group in `matchString` then it can be defined manually using this field. -It will be compiled using Handlebars and the regex `groups` result. - -### extractVersionTemplate - -If `extractVersion` cannot be captured with a named capture group in `matchString` then it can be defined manually using this field. -It will be compiled using Handlebars and the regex `groups` result. - -### packageNameTemplate - -`packageName` is used for looking up dependency versions. -It will be compiled using Handlebars and the regex `groups` result. -It will default to the value of `depName` if left unconfigured/undefined. - -### currentValueTemplate - -If the `currentValue` for a dependency is not captured with a named group then it can be defined in config using this field. -It will be compiled using Handlebars and the regex `groups` result. - -### datasourceTemplate - -If the `datasource` for a dependency is not captured with a named group then it can be defined in config using this field. -It will be compiled using Handlebars and the regex `groups` result. - -### depTypeTemplate - -If `depType` cannot be captured with a named capture group in `matchString` then it can be defined manually using this field. -It will be compiled using Handlebars and the regex `groups` result. - -### versioningTemplate - -If the `versioning` for a dependency is not captured with a named group then it can be defined in config using this field. -It will be compiled using Handlebars and the regex `groups` result. - -### registryUrlTemplate - -If the `registryUrls` for a dependency is not captured with a named group then it can be defined in config using this field. -It will be compiled using Handlebars and the regex `groups` result. - -### autoReplaceStringTemplate - -Allows overwriting how the matched string is replaced. -This allows for some migration strategies. -E.g. moving from one Docker image repository to another one. - -helm-values.yaml: - -```yaml -# The image of the service //: -image: my.old.registry/aRepository/andImage:1.18-alpine -``` - -regex definition: - -```json -{ - "regexManagers": [ - { - "fileMatch": ["values.yaml$"], - "matchStrings": [ - "image:\\s+(?my\\.old\\.registry/aRepository/andImage):(?[^\\s]+)" - ], - "depNameTemplate": "my.new.registry/aRepository/andImage", - "autoReplaceStringTemplate": "image: {{{depName}}}:{{{newValue}}}", - "datasourceTemplate": "docker" - } - ] -} -``` - -This will lead to following update where `1.21-alpine` is the newest version of `my.new.registry/aRepository/andImage`: - -```yaml -# The image of the service //: -image: my.new.registry/aRepository/andImage:1.21-alpine -``` - ## registryAliases You can use the `registryAliases` object to set registry aliases. diff --git a/docs/usage/getting-started/use-cases.md b/docs/usage/getting-started/use-cases.md index 095d72521d0007..5ab2f1c1feef91 100644 --- a/docs/usage/getting-started/use-cases.md +++ b/docs/usage/getting-started/use-cases.md @@ -58,8 +58,8 @@ This can be because: - The package manager/file format is not supported, or - The file format is not a standard or is proprietary -If your dependencies are not found by default, you can use our "regex" manager to set your own custom patterns to extract dependencies. -You configure the regex manager by telling it: +If your dependencies are not found by default, you can use our `custom` manager to set your own custom patterns to extract dependencies. +You configure the custom manager by telling it: - Which file pattern(s) to match - How to find the dependency name and version from within the file diff --git a/docs/usage/reading-list.md b/docs/usage/reading-list.md index 40834b59170683..d1adcd24e78b2e 100644 --- a/docs/usage/reading-list.md +++ b/docs/usage/reading-list.md @@ -59,7 +59,7 @@ Feel free to read up on anything that looks interesting to you. First, complete the "Beginners" and the "Intermediate" reading list. Then read: -- Define your own regex manager with [`regexManagers`](./configuration-options.md#regexmanagers) +- Define your own custom manager with [`customManagers`](./configuration-options.md#custommanagers)(previously `regexManagers`) - [Shareable config presets](./config-presets.md) ## Self-hosting Renovate diff --git a/docs/usage/user-stories/maintaining-aur-packages-with-renovate.md b/docs/usage/user-stories/maintaining-aur-packages-with-renovate.md index 7afba9a4904966..9d2a7c4cf9138d 100644 --- a/docs/usage/user-stories/maintaining-aur-packages-with-renovate.md +++ b/docs/usage/user-stories/maintaining-aur-packages-with-renovate.md @@ -39,12 +39,13 @@ Renovate comes with over 50 different datasources, but the one that is important Managers are the Renovate concept for package managers. There isn’t an AUR or `PKGBUILD` manager, but there is a [regex manager](https://docs.renovatebot.com/modules/manager/regex/) that I can use. -I can create a `renovate.json` configuration with the following regex manager configuration: +I can create a `renovate.json` configuration with the following custom manager configuration: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["(^|/)PKGBUILD$"], "matchStrings": [ "pkgver=(?.*) # renovate: datasource=(?.*) depName=(?.*)" diff --git a/docs/usage/user-stories/swissquote.md b/docs/usage/user-stories/swissquote.md index 051a7b93958ff8..64e070353a6676 100644 --- a/docs/usage/user-stories/swissquote.md +++ b/docs/usage/user-stories/swissquote.md @@ -177,7 +177,7 @@ Some features and options we enjoy: - Each rule can be customized either globally [or specified per package](../configuration-options.md#packagerules) - Works with your [private package registry](../getting-started/private-packages.md) - Supports more than 70 [languages and package managers](https://docs.renovatebot.com/modules/manager/#supported-managers): Maven, Docker, npm, Docker Compose, Python -- If you are using dependencies in a custom way, [there is a special regexManager](../configuration-options.md#regexmanagers) that allows you to transform patterns into dependencies +- If you are using dependencies in a custom way, [there is a `customManagers` option](../configuration-options.md#custommanagers) that allows you to transform patterns into dependencies There is an [on-premise option](https://www.mend.io/free-developer-tools/renovate/on-premises/), but you can also use [the Mend Renovate App](https://github.com/marketplace/renovate). On our side, we’re not using the on-premise but rather a custom scheduler using the open source Docker image. diff --git a/lib/config/__snapshots__/migration.spec.ts.snap b/lib/config/__snapshots__/migration.spec.ts.snap index 638becb9910024..b3f0b3deb66552 100644 --- a/lib/config/__snapshots__/migration.spec.ts.snap +++ b/lib/config/__snapshots__/migration.spec.ts.snap @@ -1,5 +1,33 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`config/migration it migrates customManagers 1`] = ` +{ + "customManagers": [ + { + "customType": "regex", + "fileMatch": [ + "(^|/|\\.)Dockerfile$", + "(^|/)Dockerfile[^/]*$", + ], + "matchStrings": [ + "# renovate: datasource=(?[a-z-]+?) depName=(?[^\\s]+?)(?: lookupName=(?[^\\s]+?))?(?: versioning=(?[a-z-0-9]+?))?\\s(?:ENV|ARG) .+?_VERSION="?(?.+?)"?\\s", + ], + }, + { + "customType": "regex", + "fileMatch": [ + "(^|/|\\.)Dockerfile$", + "(^|/)Dockerfile[^/]*$", + ], + "matchStrings": [ + "# renovate: datasource=(?[a-z-]+?) depName=(?[^\\s]+?)(?: lookupName=(?[^\\s]+?))?(?: versioning=(?[a-z-0-9]+?))?\\s(?:ENV|ARG) .+?_VERSION="?(?.+?)"?\\s", + ], + "packageNameTemplate": "{{{holder}}}", + }, + ], +} +`; + exports[`config/migration it migrates gradle-lite 1`] = ` { "gradle": { @@ -51,34 +79,6 @@ exports[`config/migration it migrates nested packageRules 1`] = ` } `; -exports[`config/migration it migrates regexManagers 1`] = ` -{ - "regexManagers": [ - { - "customType": "regex", - "fileMatch": [ - "(^|/|\\.)Dockerfile$", - "(^|/)Dockerfile[^/]*$", - ], - "matchStrings": [ - "# renovate: datasource=(?[a-z-]+?) depName=(?[^\\s]+?)(?: lookupName=(?[^\\s]+?))?(?: versioning=(?[a-z-0-9]+?))?\\s(?:ENV|ARG) .+?_VERSION="?(?.+?)"?\\s", - ], - }, - { - "customType": "regex", - "fileMatch": [ - "(^|/|\\.)Dockerfile$", - "(^|/)Dockerfile[^/]*$", - ], - "matchStrings": [ - "# renovate: datasource=(?[a-z-]+?) depName=(?[^\\s]+?)(?: lookupName=(?[^\\s]+?))?(?: versioning=(?[a-z-0-9]+?))?\\s(?:ENV|ARG) .+?_VERSION="?(?.+?)"?\\s", - ], - "packageNameTemplate": "{{{holder}}}", - }, - ], -} -`; - exports[`config/migration migrateConfig(config, parentConfig) does not migrate multi days 1`] = ` { "schedule": "after 5:00pm on wednesday and thursday", diff --git a/lib/config/__snapshots__/validation.spec.ts.snap b/lib/config/__snapshots__/validation.spec.ts.snap index 41f8bd38992650..c102eace3c1a5b 100644 --- a/lib/config/__snapshots__/validation.spec.ts.snap +++ b/lib/config/__snapshots__/validation.spec.ts.snap @@ -113,6 +113,15 @@ exports[`config/validation validateConfig(config) errors for unsafe fileMatches ] `; +exports[`config/validation validateConfig(config) errors if customManager fields are missing 1`] = ` +[ + { + "message": "Regex Managers must contain currentValueTemplate configuration or regex group named currentValue", + "topic": "Configuration Error", + }, +] +`; + exports[`config/validation validateConfig(config) errors if fileMatch has wrong parent 1`] = ` [ { @@ -176,15 +185,6 @@ exports[`config/validation validateConfig(config) errors if manager objects are ] `; -exports[`config/validation validateConfig(config) errors if regexManager fields are missing 1`] = ` -[ - { - "message": "Regex Managers must contain currentValueTemplate configuration or regex group named currentValue", - "topic": "Configuration Error", - }, -] -`; - exports[`config/validation validateConfig(config) ignore packageRule nesting validation for presets 1`] = `[]`; exports[`config/validation validateConfig(config) included managers of the wrong type 1`] = ` @@ -250,7 +250,7 @@ exports[`config/validation validateConfig(config) selectors outside packageRules exports[`config/validation validateConfig(config) validates regEx for each fileMatch 1`] = ` [ { - "message": "Invalid regExp for regexManagers[0].fileMatch: \`***$}{]][\`", + "message": "Invalid regExp for customManagers[0].fileMatch: \`***$}{]][\`", "topic": "Configuration Error", }, ] diff --git a/lib/config/migration.spec.ts b/lib/config/migration.spec.ts index 8f3a907702fa23..42c809ba193176 100644 --- a/lib/config/migration.spec.ts +++ b/lib/config/migration.spec.ts @@ -643,10 +643,11 @@ describe('config/migration', () => { expect(migratedConfig).toEqual({ extends: ['local>org/renovate-config'] }); }); - it('it migrates regexManagers', () => { + it('it migrates customManagers', () => { const config: RenovateConfig = { - regexManagers: [ + customManagers: [ { + customType: 'regex', fileMatch: ['(^|/|\\.)Dockerfile$', '(^|/)Dockerfile[^/]*$'], matchStrings: [ '# renovate: datasource=(?[a-z-]+?) depName=(?[^\\s]+?)(?: lookupName=(?[^\\s]+?))?(?: versioning=(?[a-z-0-9]+?))?\\s(?:ENV|ARG) .+?_VERSION="?(?.+?)"?\\s', diff --git a/lib/config/migrations/custom/regex-managers-migration.spec.ts b/lib/config/migrations/custom/custom-managers-migration.spec.ts similarity index 82% rename from lib/config/migrations/custom/regex-managers-migration.spec.ts rename to lib/config/migrations/custom/custom-managers-migration.spec.ts index be49c6bcf3c077..792975860915a4 100644 --- a/lib/config/migrations/custom/regex-managers-migration.spec.ts +++ b/lib/config/migrations/custom/custom-managers-migration.spec.ts @@ -1,12 +1,12 @@ import { partial } from '../../../../test/util'; import type { CustomManager } from '../../../modules/manager/custom/types'; -import { RegexManagersMigration } from './regex-managers-migration'; +import { CustomManagersMigration } from './custom-managers-migration'; -describe('config/migrations/custom/regex-managers-migration', () => { +describe('config/migrations/custom/custom-managers-migration', () => { it('migrates', () => { - expect(RegexManagersMigration).toMigrate( + expect(CustomManagersMigration).toMigrate( { - regexManagers: partial([ + customManagers: partial([ { fileMatch: ['js', '***$}{]]['], matchStrings: ['^(?foo)(?bar)$'], @@ -23,7 +23,7 @@ describe('config/migrations/custom/regex-managers-migration', () => { ]), }, { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['js', '***$}{]]['], diff --git a/lib/config/migrations/custom/regex-managers-migration.ts b/lib/config/migrations/custom/custom-managers-migration.ts similarity index 58% rename from lib/config/migrations/custom/regex-managers-migration.ts rename to lib/config/migrations/custom/custom-managers-migration.ts index afaad6c80537b2..7131bac2054fde 100644 --- a/lib/config/migrations/custom/regex-managers-migration.ts +++ b/lib/config/migrations/custom/custom-managers-migration.ts @@ -2,19 +2,19 @@ import is from '@sindresorhus/is'; import type { CustomManager } from '../../../modules/manager/custom/types'; import { AbstractMigration } from '../base/abstract-migration'; -export class RegexManagersMigration extends AbstractMigration { - override readonly propertyName = 'regexManagers'; +export class CustomManagersMigration extends AbstractMigration { + override readonly propertyName = 'customManagers'; override run(value: unknown): void { if (is.nonEmptyArray(value)) { - const regexManagers = (value as CustomManager[]).map((mgr) => { + const customManagers = (value as CustomManager[]).map((mgr) => { if (mgr.customType) { return mgr; } - return Object.assign({ customType: 'regex' }, mgr); // to make sure customType is at top, looks good when migration pr is created + return Object.assign({ customType: 'regex' }, mgr); // to make sure customType is at top, looks good when migration PR is created }); - this.rewrite(regexManagers); + this.rewrite(customManagers); } } } diff --git a/lib/config/migrations/migrations-service.ts b/lib/config/migrations/migrations-service.ts index 2bff1be478c00a..7162d697bbb37a 100644 --- a/lib/config/migrations/migrations-service.ts +++ b/lib/config/migrations/migrations-service.ts @@ -15,6 +15,7 @@ import { BranchNameMigration } from './custom/branch-name-migration'; import { BranchPrefixMigration } from './custom/branch-prefix-migration'; import { CompatibilityMigration } from './custom/compatibility-migration'; import { ComposerIgnorePlatformReqsMigration } from './custom/composer-ignore-platform-reqs-migration'; +import { CustomManagersMigration } from './custom/custom-managers-migration'; import { DatasourceMigration } from './custom/datasource-migration'; import { DepTypesMigration } from './custom/dep-types-migration'; import { DryRunMigration } from './custom/dry-run-migration'; @@ -41,7 +42,6 @@ import { RaiseDeprecationWarningsMigration } from './custom/raise-deprecation-wa import { RebaseConflictedPrs } from './custom/rebase-conflicted-prs-migration'; import { RebaseStalePrsMigration } from './custom/rebase-stale-prs-migration'; import { RecreateClosedMigration } from './custom/recreate-closed-migration'; -import { RegexManagersMigration } from './custom/regex-managers-migration'; import { RenovateForkMigration } from './custom/renovate-fork-migration'; import { RequireConfigMigration } from './custom/require-config-migration'; import { RequiredStatusChecksMigration } from './custom/required-status-checks-migration'; @@ -96,6 +96,7 @@ export class MigrationsService { ['masterIssueFooter', 'dependencyDashboardFooter'], ['masterIssueTitle', 'dependencyDashboardTitle'], ['masterIssueLabels', 'dependencyDashboardLabels'], + ['regexManagers', 'customManagers'], ]); static readonly customMigrations: ReadonlyArray = [ @@ -151,7 +152,7 @@ export class MigrationsService { RecreateClosedMigration, StabilityDaysMigration, FetchReleaseNotesMigration, - RegexManagersMigration, + CustomManagersMigration, ]; static run(originalConfig: RenovateConfig): RenovateConfig { diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index 42a9d739652297..0d00f5745a0d14 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -2493,7 +2493,7 @@ const options: RenovateOptions[] = [ default: false, }, { - name: 'regexManagers', + name: 'customManagers', description: 'Custom managers using regex matching.', type: 'array', subType: 'object', @@ -2505,21 +2505,21 @@ const options: RenovateOptions[] = [ { name: 'customType', description: - 'Custom manager to use. Valid only within a `regexManagers` object.', + 'Custom manager to use. Valid only within a `customManagers` object.', type: 'string', allowedValues: ['regex'], - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'matchStrings', description: - 'Regex capture rule to use. Valid only within a `regexManagers` object.', + 'Regex capture rule to use. Valid only within a `customManagers` object.', type: 'array', subType: 'string', format: 'regex', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, @@ -2529,88 +2529,88 @@ const options: RenovateOptions[] = [ type: 'string', default: 'any', allowedValues: ['any', 'recursive', 'combination'], - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'depNameTemplate', description: - 'Optional depName for extracted dependencies. Valid only within a `regexManagers` object.', + 'Optional depName for extracted dependencies. Valid only within a `customManagers` object.', type: 'string', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'packageNameTemplate', description: - 'Optional packageName for extracted dependencies, else defaults to `depName` value. Valid only within a `regexManagers` object.', + 'Optional packageName for extracted dependencies, else defaults to `depName` value. Valid only within a `customManagers` object.', type: 'string', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'datasourceTemplate', description: - 'Optional datasource for extracted dependencies. Valid only within a `regexManagers` object.', + 'Optional datasource for extracted dependencies. Valid only within a `customManagers` object.', type: 'string', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'depTypeTemplate', description: - 'Optional `depType` for extracted dependencies. Valid only within a `regexManagers` object.', + 'Optional `depType` for extracted dependencies. Valid only within a `customManagers` object.', type: 'string', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'currentValueTemplate', description: - 'Optional `currentValue` for extracted dependencies. Valid only within a `regexManagers` object.', + 'Optional `currentValue` for extracted dependencies. Valid only within a `customManagers` object.', type: 'string', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'versioningTemplate', description: - 'Optional versioning for extracted dependencies. Valid only within a `regexManagers` object.', + 'Optional versioning for extracted dependencies. Valid only within a `customManagers` object.', type: 'string', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'registryUrlTemplate', description: - 'Optional registry URL for extracted dependencies. Valid only within a `regexManagers` object.', + 'Optional registry URL for extracted dependencies. Valid only within a `customManagers` object.', type: 'string', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'extractVersionTemplate', description: - 'Optional `extractVersion` for extracted dependencies. Valid only within a `regexManagers` object.', + 'Optional `extractVersion` for extracted dependencies. Valid only within a `customManagers` object.', type: 'string', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, { name: 'autoReplaceStringTemplate', description: - 'Optional `extractVersion` for extracted dependencies. Valid only within a `regexManagers` object.', + 'Optional `extractVersion` for extracted dependencies. Valid only within a `customManagers` object.', type: 'string', - parent: 'regexManagers', + parent: 'customManagers', cli: false, env: false, }, diff --git a/lib/config/presets/internal/regex-managers.spec.ts b/lib/config/presets/internal/regex-managers.spec.ts index f4464c5150f961..074e59a7b534b2 100644 --- a/lib/config/presets/internal/regex-managers.spec.ts +++ b/lib/config/presets/internal/regex-managers.spec.ts @@ -5,7 +5,7 @@ import { presets } from './regex-managers'; describe('config/presets/internal/regex-managers', () => { describe('Update `_VERSION` variables in Dockerfiles', () => { - const regexManager = presets['dockerfileVersions'].regexManagers?.[0]; + const customManager = presets['dockerfileVersions'].customManagers?.[0]; it(`find dependencies in file`, async () => { const fileContent = codeBlock` @@ -29,7 +29,7 @@ describe('config/presets/internal/regex-managers', () => { const res = await extractPackageFile( fileContent, 'Dockerfile', - regexManager! + customManager! ); expect(res?.deps).toMatchObject([ @@ -76,13 +76,13 @@ describe('config/presets/internal/regex-managers', () => { ${'foo/Dockerfile-foo'} | ${true} ${'foo-Dockerfile'} | ${false} `('$path', ({ path, expected }) => { - expect(regexMatches(path, regexManager!.fileMatch)).toBe(expected); + expect(regexMatches(path, customManager!.fileMatch)).toBe(expected); }); }); }); describe('Update `_VERSION` environment variables in GitHub Action files', () => { - const regexManager = presets['githubActionsVersions'].regexManagers?.[0]; + const customManager = presets['githubActionsVersions'].customManagers?.[0]; it(`find dependencies in file`, async () => { const fileContent = codeBlock` @@ -116,7 +116,7 @@ describe('config/presets/internal/regex-managers', () => { const res = await extractPackageFile( fileContent, 'github-workflow.yaml', - regexManager! + customManager! ); expect(res?.deps).toMatchObject([ @@ -168,13 +168,14 @@ describe('config/presets/internal/regex-managers', () => { ${'.github/workflows/foo.json'} | ${false} ${'.github/workflows/foo.yamlo'} | ${false} `('$path', ({ path, expected }) => { - expect(regexMatches(path, regexManager!.fileMatch)).toBe(expected); + expect(regexMatches(path, customManager!.fileMatch)).toBe(expected); }); }); }); describe('Update `appVersion` value in Helm chart Chart.yaml', () => { - const regexManager = presets['helmChartYamlAppVersions'].regexManagers?.[0]; + const customManager = + presets['helmChartYamlAppVersions'].customManagers?.[0]; it(`find dependencies in file`, async () => { const fileContent = codeBlock` @@ -192,7 +193,7 @@ describe('config/presets/internal/regex-managers', () => { const res = await extractPackageFile( fileContent, 'Chart.yaml', - regexManager! + customManager! ); expect(res?.deps).toMatchObject([ @@ -228,13 +229,13 @@ describe('config/presets/internal/regex-managers', () => { ${'Chart.yamlo'} | ${false} ${'Charto.yaml'} | ${false} `('$path', ({ path, expected }) => { - expect(regexMatches(path, regexManager!.fileMatch)).toBe(expected); + expect(regexMatches(path, customManager!.fileMatch)).toBe(expected); }); }); }); describe('finds dependencies in pom.xml properties', () => { - const regexManager = presets['mavenPropertyVersions'].regexManagers?.[0]; + const customManager = presets['mavenPropertyVersions'].customManagers?.[0]; it(`find dependencies in file`, async () => { const fileContent = codeBlock` @@ -251,7 +252,7 @@ describe('config/presets/internal/regex-managers', () => { const res = await extractPackageFile( fileContent, 'pom.xml', - regexManager! + customManager! ); expect(res?.deps).toMatchObject([ diff --git a/lib/config/presets/internal/regex-managers.ts b/lib/config/presets/internal/regex-managers.ts index ac9bff0f4369dd..47e16cd9185982 100644 --- a/lib/config/presets/internal/regex-managers.ts +++ b/lib/config/presets/internal/regex-managers.ts @@ -4,8 +4,7 @@ import type { Preset } from '../types'; export const presets: Record = { dockerfileVersions: { - description: 'Update `_VERSION` variables in Dockerfiles.', - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: [ @@ -17,11 +16,10 @@ export const presets: Record = { ], }, ], + description: 'Update `_VERSION` variables in Dockerfiles.', }, githubActionsVersions: { - description: - 'Update `_VERSION` environment variables in GitHub Action files.', - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['^.github/(?:workflows|actions)/.+\\.ya?ml$'], @@ -30,10 +28,11 @@ export const presets: Record = { ], }, ], + description: + 'Update `_VERSION` environment variables in GitHub Action files.', }, helmChartYamlAppVersions: { - description: 'Update `appVersion` value in Helm chart `Chart.yaml`.', - regexManagers: [ + customManagers: [ { customType: 'regex', datasourceTemplate: 'docker', @@ -43,10 +42,10 @@ export const presets: Record = { ], }, ], + description: 'Update `appVersion` value in Helm chart `Chart.yaml`.', }, mavenPropertyVersions: { - description: 'Update `*.version` properties in `pom.xml` files.', - regexManagers: [ + customManagers: [ { customType: 'regex', datasourceTemplate: @@ -58,10 +57,10 @@ export const presets: Record = { versioningTemplate: '{{#if versioning}}{{{versioning}}}{{/if}}', }, ], + description: 'Update `*.version` properties in `pom.xml` files.', }, tfvarsVersions: { - description: 'Update `*_version` variables in `.tfvars` files.', - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['.+\\.tfvars$'], @@ -71,5 +70,6 @@ export const presets: Record = { versioningTemplate: '{{#if versioning}}{{{versioning}}}{{/if}}', }, ], + description: 'Update `*_version` variables in `.tfvars` files.', }, }; diff --git a/lib/config/types.ts b/lib/config/types.ts index ac6fa1788f70db..6a3178f6e0196a 100644 --- a/lib/config/types.ts +++ b/lib/config/types.ts @@ -247,7 +247,7 @@ export interface RenovateConfig vulnerabilityAlerts?: RenovateSharedConfig; osvVulnerabilityAlerts?: boolean; vulnerabilitySeverity?: string; - regexManagers?: CustomManager[]; + customManagers?: CustomManager[]; customDatasources?: Record; fetchReleaseNotes?: FetchReleaseNotesOptions; @@ -382,7 +382,7 @@ export interface RenovateOptionBase { | 'hostRules' | 'packageRules' | 'postUpgradeTasks' - | 'regexManagers'; + | 'customManagers'; stage?: RenovateConfigStage; diff --git a/lib/config/validation.spec.ts b/lib/config/validation.spec.ts index 785fd217b2e67f..59c3676f981164 100644 --- a/lib/config/validation.spec.ts +++ b/lib/config/validation.spec.ts @@ -373,7 +373,7 @@ describe('config/validation', () => { it('validates regEx for each fileMatch', async () => { const config: RenovateConfig = { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['js', '***$}{]]['], @@ -392,9 +392,9 @@ describe('config/validation', () => { expect(errors).toMatchSnapshot(); }); - it('errors if regexManager has empty fileMatch', async () => { + it('errors if customManager has empty fileMatch', async () => { const config = { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: [], @@ -410,16 +410,16 @@ describe('config/validation', () => { expect(errors).toMatchInlineSnapshot(` [ { - "message": "Each Regex Manager must contain a non-empty fileMatch array", + "message": "Each Custom Manager must contain a non-empty fileMatch array", "topic": "Configuration Error", }, ] `); }); - it('errors if no regexManager customType', async () => { + it('errors if no customManager customType', async () => { const config = { - regexManagers: [ + customManagers: [ { fileMatch: ['some-file'], matchStrings: ['^(?foo)(?bar)$'], @@ -437,16 +437,16 @@ describe('config/validation', () => { expect(errors).toMatchInlineSnapshot(` [ { - "message": "Each Regex Manager must contain a non-empty customType string", + "message": "Each Custom Manager must contain a non-empty customType string", "topic": "Configuration Error", }, ] `); }); - it('errors if invalid regexManager customType', async () => { + it('errors if invalid customManager customType', async () => { const config = { - regexManagers: [ + customManagers: [ { customType: 'unknown', fileMatch: ['some-file'], @@ -472,9 +472,9 @@ describe('config/validation', () => { `); }); - it('errors if empty regexManager matchStrings', async () => { + it('errors if empty customManager matchStrings', async () => { const config = { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['foo'], @@ -501,20 +501,20 @@ describe('config/validation', () => { expect(errors).toMatchInlineSnapshot(` [ { - "message": "Each Regex Manager must contain a non-empty matchStrings array", + "message": "Each Custom Manager must contain a non-empty matchStrings array", "topic": "Configuration Error", }, { - "message": "Each Regex Manager must contain a non-empty matchStrings array", + "message": "Each Custom Manager must contain a non-empty matchStrings array", "topic": "Configuration Error", }, ] `); }); - it('errors if no regexManager fileMatch', async () => { + it('errors if no customManager fileMatch', async () => { const config = { - regexManagers: [ + customManagers: [ { matchStrings: ['^(?foo)(?bar)$'], datasourceTemplate: 'maven', @@ -532,7 +532,7 @@ describe('config/validation', () => { it('validates regEx for each matchStrings', async () => { const config: RenovateConfig = { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['Dockerfile'], @@ -555,7 +555,7 @@ describe('config/validation', () => { // since they are common to all custom managers it('validates all possible regex manager options', async () => { const config: RenovateConfig = { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['Dockerfile'], @@ -571,9 +571,9 @@ describe('config/validation', () => { expect(errors).toHaveLength(4); }); - it('passes if regexManager fields are present', async () => { + it('passes if customManager fields are present', async () => { const config: RenovateConfig = { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['Dockerfile'], @@ -594,9 +594,9 @@ describe('config/validation', () => { expect(errors).toHaveLength(0); }); - it('errors if extra regexManager fields are present', async () => { + it('errors if extra customManager fields are present', async () => { const config = { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['Dockerfile'], @@ -616,9 +616,9 @@ describe('config/validation', () => { expect(errors).toHaveLength(1); }); - it('errors if regexManager fields are missing', async () => { + it('errors if customManager fields are missing', async () => { const config: RenovateConfig = { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['Dockerfile'], @@ -749,7 +749,7 @@ describe('config/validation', () => { fileMatch: ['bar'], }, }, - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['build.gradle'], diff --git a/lib/config/validation.ts b/lib/config/validation.ts index d63a47aaaa2cbf..56217ec95400a3 100644 --- a/lib/config/validation.ts +++ b/lib/config/validation.ts @@ -51,7 +51,7 @@ const rulesRe = regEx(/p.*Rules\[\d+\]$/); function isManagerPath(parentPath: string): boolean { return ( - regEx(/^regexManagers\[[0-9]+]$/).test(parentPath) || + regEx(/^customManagers\[[0-9]+]$/).test(parentPath) || managerList.includes(parentPath) ); } @@ -405,7 +405,7 @@ export async function validateConfig( } } } - if (key === 'regexManagers') { + if (key === 'customManagers') { const allowedKeys = [ 'customType', 'description', @@ -422,30 +422,30 @@ export async function validateConfig( 'autoReplaceStringTemplate', 'depTypeTemplate', ]; - for (const regexManager of val as CustomManager[]) { + for (const customManager of val as CustomManager[]) { if ( - Object.keys(regexManager).some( + Object.keys(customManager).some( (k) => !allowedKeys.includes(k) ) ) { - const disallowedKeys = Object.keys(regexManager).filter( + const disallowedKeys = Object.keys(customManager).filter( (k) => !allowedKeys.includes(k) ); errors.push({ topic: 'Configuration Error', - message: `Regex Manager contains disallowed fields: ${disallowedKeys.join( + message: `Custom Manager contains disallowed fields: ${disallowedKeys.join( ', ' )}`, }); } else if ( - is.nonEmptyString(regexManager.customType) && - isCustomManager(regexManager.customType) + is.nonEmptyString(customManager.customType) && + isCustomManager(customManager.customType) ) { - if (is.nonEmptyArray(regexManager.fileMatch)) { - switch (regexManager.customType) { + if (is.nonEmptyArray(customManager.fileMatch)) { + switch (customManager.customType) { case 'regex': validateRegexManagerFields( - regexManager, + customManager, currentPath, errors ); @@ -454,22 +454,22 @@ export async function validateConfig( } else { errors.push({ topic: 'Configuration Error', - message: `Each Regex Manager must contain a non-empty fileMatch array`, + message: `Each Custom Manager must contain a non-empty fileMatch array`, }); } } else { if ( - is.emptyString(regexManager.customType) || - is.undefined(regexManager.customType) + is.emptyString(customManager.customType) || + is.undefined(customManager.customType) ) { errors.push({ topic: 'Configuration Error', - message: `Each Regex Manager must contain a non-empty customType string`, + message: `Each Custom Manager must contain a non-empty customType string`, }); } else { errors.push({ topic: 'Configuration Error', - message: `Invalid customType: ${regexManager.customType}. Key is not a custom manager`, + message: `Invalid customType: ${customManager.customType}. Key is not a custom manager`, }); } } @@ -659,12 +659,12 @@ export async function validateConfig( } function validateRegexManagerFields( - regexManager: Partial, + customManager: Partial, currentPath: string, errors: ValidationMessage[] ): void { - if (is.nonEmptyArray(regexManager.matchStrings)) { - for (const matchString of regexManager.matchStrings) { + if (is.nonEmptyArray(customManager.matchStrings)) { + for (const matchString of customManager.matchStrings) { try { regEx(matchString); } catch (e) { @@ -677,7 +677,7 @@ function validateRegexManagerFields( } else { errors.push({ topic: 'Configuration Error', - message: `Each Regex Manager must contain a non-empty matchStrings array`, + message: `Each Custom Manager must contain a non-empty matchStrings array`, }); } @@ -685,8 +685,8 @@ function validateRegexManagerFields( for (const field of mandatoryFields) { const templateField = `${field}Template` as keyof RegexManagerTemplates; if ( - !regexManager[templateField] && - !regexManager.matchStrings?.some((matchString) => + !customManager[templateField] && + !customManager.matchStrings?.some((matchString) => matchString.includes(`(?<${field}>`) ) ) { diff --git a/lib/modules/datasource/aws-machine-image/readme.md b/lib/modules/datasource/aws-machine-image/readme.md index 909327622f937b..bbda36b359eec0 100644 --- a/lib/modules/datasource/aws-machine-image/readme.md +++ b/lib/modules/datasource/aws-machine-image/readme.md @@ -51,15 +51,15 @@ Example: ``` At the moment, this datasource has no "manager". -You have to use the regex manager for this. +You have to use the custom manager for this. **Usage Example** -Here's an example of using the regex manager: +Here's an example of using the custom manager: ```javascript module.exports = { - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['.*'], @@ -77,7 +77,7 @@ Or as JSON: ```yaml { - 'regexManagers': + 'customManagers': [ { 'customType': 'regex', diff --git a/lib/modules/datasource/aws-rds/readme.md b/lib/modules/datasource/aws-rds/readme.md index fa074ab26005a8..be47f3644d2c1b 100644 --- a/lib/modules/datasource/aws-rds/readme.md +++ b/lib/modules/datasource/aws-rds/readme.md @@ -29,9 +29,9 @@ Read the [AWS RDS IAM reference](https://docs.aws.amazon.com/service-authorizati **Usage** -Because Renovate has no manager for the AWS RDS datasource, you need to help Renovate by configuring the regex manager to identify the RDS dependencies you want updated. +Because Renovate has no manager for the AWS RDS datasource, you need to help Renovate by configuring the custom manager to identify the RDS dependencies you want updated. -When configuring the regex manager, you have to pass a [filter](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-rds/interfaces/describedbengineversionscommandinput.html#filters) as minified JSON as the `packageName`. +When configuring the custom manager, you have to pass a [filter](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-rds/interfaces/describedbengineversionscommandinput.html#filters) as minified JSON as the `packageName`. For example: ```yaml @@ -53,12 +53,13 @@ For example: [{"Name":"engine","Values":["mysql"]},{"Name":"engine-version","Values":["5.7"]}] ``` -Here's an example of using the regex manager to configure this datasource: +Here's an example of using the custom manager to configure this datasource: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["\\.yaml$"], "matchStrings": [ ".*amiFilter=(?.+?)[ ]*\n[ ]*(?[a-zA-Z0-9-_:]*)[ ]*?:[ ]*?[\"|']?(?[.\\d]+)[\"|']?.*" diff --git a/lib/modules/datasource/custom/readme.md b/lib/modules/datasource/custom/readme.md index b0be066f699e09..288856418c300b 100644 --- a/lib/modules/datasource/custom/readme.md +++ b/lib/modules/datasource/custom/readme.md @@ -3,7 +3,7 @@ This `custom` datasource allows requesting version data from generic HTTP(S) end ## Usage The `customDatasources` option takes a record of `customDatasource` configs. -This example shows how to update the `k3s.version` file with a custom datasource and a [regexManagers](../../manager/regex/index.md): +This example shows how to update the `k3s.version` file with a custom datasource and a [regex](../../manager/regex/index.md) custom manager: Options: @@ -19,8 +19,9 @@ Available template variables: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["k3s.version"], "matchStrings": ["(?\\S+)"], "depNameTemplate": "k3s", @@ -142,8 +143,9 @@ You can use this configuration to request the newest versions of the Hashicorp p ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["\\.yml$"], "datasourceTemplate": "custom.hashicorp", "matchStrings": [ @@ -176,8 +178,9 @@ You can use the following configuration to upgrade the Grafana Dashboards versio ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["\\.yml$"], "matchStrings": [ "#\\s+renovate:\\s+depName=\"(?.*)\"\\n\\s+gnetId:\\s+(?.*?)\\n\\s+revision:\\s+(?.*)" @@ -249,7 +252,7 @@ This example uses Nexus as the webserver. } ``` -This could be used to update Ansible YAML files with the latest version through a regex manager. +This could be used to update Ansible YAML files with the latest version through a custom manager. For example, with the following Ansible content: ```yaml @@ -257,12 +260,13 @@ For example, with the following Ansible content: something_version: '77' ``` -And the following regex manager: +And the following custom manager: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["\\.yml$"], "datasourceTemplate": "custom.nexus_generic", "matchStrings": [ diff --git a/lib/modules/datasource/endoflife-date/readme.md b/lib/modules/datasource/endoflife-date/readme.md index 36cec9fd13ca70..202f25039f19a3 100644 --- a/lib/modules/datasource/endoflife-date/readme.md +++ b/lib/modules/datasource/endoflife-date/readme.md @@ -20,8 +20,9 @@ Given the above `.tfvars` file, you put this in your `renovate.json`: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "description": "Update Kubernetes version for Amazon EKS in tfvars files", "fileMatch": [".+\\.tfvars$"], "matchStrings": [ diff --git a/lib/modules/datasource/git-refs/readme.md b/lib/modules/datasource/git-refs/readme.md index 86d27e39bb9e8d..0e0a989bc8b466 100644 --- a/lib/modules/datasource/git-refs/readme.md +++ b/lib/modules/datasource/git-refs/readme.md @@ -7,12 +7,13 @@ To fetch the latest digest of a reference instead of the named reference, specif **Usage example** The following is an example where you would maintain the HEAD digest of the `master` branch of a repository. -You would configure a generic regex manager in `renovate.json` for files named `versions.ini`: +You would configure a custom manager in `renovate.json` for files named `versions.ini`: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["^versions.ini$"], "matchStrings": ["GOOGLE_API_VERSION=(?.*?)\\n"], "currentValueTemplate": "master", diff --git a/lib/modules/datasource/gitlab-packages/readme.md b/lib/modules/datasource/gitlab-packages/readme.md index 54388f498c83ce..42d39d0f78c07e 100644 --- a/lib/modules/datasource/gitlab-packages/readme.md +++ b/lib/modules/datasource/gitlab-packages/readme.md @@ -15,12 +15,13 @@ If you are using a self-hosted GitLab instance, please note the following requir **Usage Example** A real-world example for this specific datasource would be maintaining package versions in a config file. -This can be achieved by configuring a generic regex manager in `renovate.json` for files named `versions.ini`: +This can be achieved by configuring a custom manager in `renovate.json` for files named `versions.ini`: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["^versions.ini$"], "matchStrings": [ "# renovate: datasource=(?.*?) depName=(?.*?)( versioning=(?.*?))?( registryUrl=(?.*?))?\\s.*?_VERSION=(?.*)\\s" diff --git a/lib/modules/datasource/gitlab-releases/readme.md b/lib/modules/datasource/gitlab-releases/readme.md index 5b916841b8c993..53952f713415e3 100644 --- a/lib/modules/datasource/gitlab-releases/readme.md +++ b/lib/modules/datasource/gitlab-releases/readme.md @@ -14,12 +14,13 @@ Please note the following requirements: **Usage Example** A real-world example for this specific datasource would be maintaining package versions in a config file. -This can be achieved by configuring a generic regex manager in `renovate.json` for files named `versions.ini`: +This can be achieved by configuring a custom manager in `renovate.json` for files named `versions.ini`: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["^versions.ini$"], "matchStrings": [ "# renovate: datasource=(?.*?) depName=(?.*?)( versioning=(?.*?))?( registryUrl=(?.*?))?\\s.*?_VERSION=(?.*)\\s" diff --git a/lib/modules/datasource/gitlab-tags/readme.md b/lib/modules/datasource/gitlab-tags/readme.md index d637c6042cdc24..31f22fe2e2591b 100644 --- a/lib/modules/datasource/gitlab-tags/readme.md +++ b/lib/modules/datasource/gitlab-tags/readme.md @@ -9,12 +9,13 @@ To specify where to find a self-hosted GitLab instance, specify `registryUrl`. A **Usage Example** A real-world example for this specific datasource would be maintaining package versions in a config file. -This can be achieved by configuring a generic regex manager in `renovate.json` for files named `versions.ini`: +This can be achieved by configuring a custom manager in `renovate.json` for files named `versions.ini`: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["^versions.ini$"], "matchStrings": [ "# renovate: datasource=(?.*?) depName=(?.*?)( versioning=(?.*?))?( registryUrl=(?.*?))?\\s.*?_VERSION=(?.*)\\s" diff --git a/lib/modules/datasource/repology/readme.md b/lib/modules/datasource/repology/readme.md index a2aa0dedb6d5c9..9173fff287e222 100644 --- a/lib/modules/datasource/repology/readme.md +++ b/lib/modules/datasource/repology/readme.md @@ -14,12 +14,13 @@ For example, the `Alpine Linux 3.12` repository has this URL: `https://repology. Say you're using system packages in a Dockerfile and want to update them with Repology. With the Repology datasource you can "pin" each dependency, and get automatic updates. -First you would set a generic regex manager in your `renovate.json` file for `Dockerfile`: +First you would set a custom manager in your `renovate.json` file for `Dockerfile`: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["^Dockerfile$"], "matchStrings": [ "#\\s*renovate:\\s*datasource=(?.*?) depName=(?.*?)( versioning=(?.*?))?\\sENV .*?_VERSION=\"(?.*)\"\\s" diff --git a/lib/modules/manager/custom/regex/readme.md b/lib/modules/manager/custom/regex/readme.md index de2920487924b6..6c91fd35d930cd 100644 --- a/lib/modules/manager/custom/regex/readme.md +++ b/lib/modules/manager/custom/regex/readme.md @@ -4,17 +4,17 @@ The `regex` manager is unique in Renovate because: - It is configurable via regex named capture groups - It can extract any `datasource` -- By using the `regexManagers` config, you can create multiple "regex managers" for the same repository +- By using the `customManagers` config, you can create multiple "regex managers" for the same repository We have [additional Handlebars helpers](https://docs.renovatebot.com/templates/#additional-handlebars-helpers) to help you perform common transformations on the regex manager's template fields. -Also read the documentation for the [`regexManagers` config option](https://docs.renovatebot.com/configuration-options/#regexmanagers). +Also read the documentation for the [`customManagers` config option](https://docs.renovatebot.com/configuration-options/#custommanagers). ### Required Fields The first two required fields are `fileMatch` and `matchStrings`: - `fileMatch` works the same as any manager -- `matchStrings` is a `regexManagers` concept and is used for configuring a regular expression with named capture groups +- `matchStrings` is a `regex` custom manager concept and is used for configuring a regular expression with named capture groups Before Renovate can look up a dependency and decide about updates, it needs this information about each dependency: @@ -64,8 +64,9 @@ Continuing the above example with Yarn, here is the full Renovate config: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["^Dockerfile$"], "matchStrings": ["ENV YARN_VERSION=(?.*?)\\n"], "depNameTemplate": "yarn", @@ -78,7 +79,7 @@ Continuing the above example with Yarn, here is the full Renovate config: ### Advanced Capture Say your `Dockerfile` has many `ENV` variables that you want to keep up-to-date. -But you don't want to write a `regexManagers` rule for _each_ variable. +But you don't want to write a regex custom manager rule for _each_ variable. Instead you enhance your `Dockerfile` like this: ```Dockerfile @@ -100,8 +101,9 @@ You could configure Renovate to update the `Dockerfile` like this: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": ["^Dockerfile$"], "matchStrings": [ "datasource=(?.*?) depName=(?.*?)( versioning=(?.*?))?\\sENV .*?_VERSION=(?.*)\\s" @@ -125,7 +127,7 @@ But we included the `versioningTemplate` config option to show you why we call t You should use triple brace `{{{ }}}` templates like `{{{versioning}}}` to be safe. This is because Handlebars escapes special characters with double braces (by default). -By adding `renovate: datasource=` and `depName=` comments to the `Dockerfile` you only need _one_ `regexManager` instead of _four_. +By adding `renovate: datasource=` and `depName=` comments to the `Dockerfile` you only need _one_ `customManager` instead of _four_. The `Dockerfile` is documented better as well. The syntax in the example is arbitrary, and you can set your own syntax. @@ -145,12 +147,13 @@ type: application appVersion: 'v0.4.0' ``` -Using the `regexManagers` below, Renovate looks for available Docker tags of the image `amazon/amazon-eks-pod-identity-webhook`. +Using the `customManagers` below, Renovate looks for available Docker tags of the image `amazon/amazon-eks-pod-identity-webhook`. ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "datasourceTemplate": "docker", "fileMatch": ["(^|/)Chart\\.yaml$"], "matchStrings": [ @@ -161,7 +164,7 @@ Using the `regexManagers` below, Renovate looks for available Docker tags of the } ``` -### Using regexManager to update the dependency name in addition to version +### Using customManager to update the dependency name in addition to version #### Updating `gitlab-ci include` dep names @@ -173,8 +176,9 @@ For example: ```json { - "regexManagers": [ + "customManagers": [ { + "customType": "regex", "fileMatch": [".*y[a]?ml$"], "matchStringsStrategy": "combination", "matchStrings": [ diff --git a/lib/workers/repository/extract/extract-fingerprint-config.spec.ts b/lib/workers/repository/extract/extract-fingerprint-config.spec.ts index 34f46c9d3bec62..ade8d1b42d2c3c 100644 --- a/lib/workers/repository/extract/extract-fingerprint-config.spec.ts +++ b/lib/workers/repository/extract/extract-fingerprint-config.spec.ts @@ -20,7 +20,7 @@ describe('workers/repository/extract/extract-fingerprint-config', () => { }, }, enabledManagers: ['npm', 'regex'], - regexManagers: [ + customManagers: [ { customType: 'regex', fileMatch: ['js', '***$}{]]['], diff --git a/lib/workers/repository/extract/extract-fingerprint-config.ts b/lib/workers/repository/extract/extract-fingerprint-config.ts index 8f3bf56a2fbf33..c30139c8744138 100644 --- a/lib/workers/repository/extract/extract-fingerprint-config.ts +++ b/lib/workers/repository/extract/extract-fingerprint-config.ts @@ -12,7 +12,8 @@ export interface FingerprintExtractConfig { managers: WorkerExtractConfig[]; } -function getRegexManagerFields( +// checks for regex manager fields +function getCustomManagerFields( config: WorkerExtractConfig ): CustomExtractConfig { const regexFields = {} as CustomExtractConfig; @@ -36,7 +37,7 @@ function getFilteredManagerConfig( config: WorkerExtractConfig ): WorkerExtractConfig { return { - ...(isCustomManager(config.manager) && getRegexManagerFields(config)), + ...(isCustomManager(config.manager) && getCustomManagerFields(config)), manager: config.manager, fileMatch: config.fileMatch, npmrc: config.npmrc, @@ -65,7 +66,7 @@ export function generateFingerprintConfig( for (const manager of managerList) { const managerConfig = getManagerConfig(config, manager); if (isCustomManager(manager)) { - const filteredCustomManagers = (config.regexManagers ?? []).filter( + const filteredCustomManagers = (config.customManagers ?? []).filter( (mgr) => mgr.customType === manager ); for (const customManager of filteredCustomManagers) { diff --git a/lib/workers/repository/extract/index.spec.ts b/lib/workers/repository/extract/index.spec.ts index 7d257cbbc3a049..5cdf1a9f1a880b 100644 --- a/lib/workers/repository/extract/index.spec.ts +++ b/lib/workers/repository/extract/index.spec.ts @@ -25,7 +25,7 @@ describe('workers/repository/extract/index', () => { managerFiles.getManagerPackageFiles.mockResolvedValue([ partial>>({}), ]); - delete config.regexManagers; // for coverage + delete config.customManagers; // for coverage const res = await extractAllDependencies(config); expect(Object.keys(res.packageFiles)).toContain('ansible'); }); @@ -58,7 +58,7 @@ describe('workers/repository/extract/index', () => { managerFiles.getManagerPackageFiles.mockResolvedValue([ partial>>({}), ]); - config.regexManagers = [ + config.customManagers = [ { customType: 'regex', fileMatch: ['README'], matchStrings: [''] }, ]; const res = await extractAllDependencies(config); diff --git a/lib/workers/repository/extract/index.ts b/lib/workers/repository/extract/index.ts index 04cdc3200a29a3..925d96a6c39a4b 100644 --- a/lib/workers/repository/extract/index.ts +++ b/lib/workers/repository/extract/index.ts @@ -35,7 +35,7 @@ export async function extractAllDependencies( const managerConfig = getManagerConfig(config, manager); managerConfig.manager = manager; if (isCustomManager(manager)) { - const filteredCustomManagers = (config.regexManagers ?? []).filter( + const filteredCustomManagers = (config.customManagers ?? []).filter( (mgr) => mgr.customType === manager ); for (const customManager of filteredCustomManagers) {