From 46f6511c1afcb2036223b2061a7b7073e0cbd483 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sat, 3 Apr 2021 09:33:15 +0200 Subject: [PATCH 1/4] feat(config): empty manager additionalBranchPrefix Resets any language or manager additionalBranchPrefix values to empty string. Add the `compatibility:additionalBranchPrefix` prefix to restore previous behavior. BREAKING CHANGE: Removal of default additionalBranchPrefix values will cause branch names to change for docker/helm/buildkite/cargo/homebrew. --- docs/usage/configuration-options.md | 2 +- docs/usage/configuration-templates.md | 3 +-- lib/config/presets/index.ts | 1 + lib/config/presets/internal/compatibility.ts | 21 ++++++++++++++++++++ lib/config/presets/internal/index.ts | 2 ++ lib/datasource/docker/index.ts | 1 - lib/datasource/helm/index.ts | 1 - lib/manager/buildkite/index.ts | 1 - lib/manager/cargo/index.ts | 1 - lib/manager/homebrew/index.ts | 1 - lib/workers/repository/updates/flatten.ts | 8 -------- 11 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 lib/config/presets/internal/compatibility.ts diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index a8f43c2a7cc12a..1165cab962f4f8 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -69,7 +69,7 @@ With the above config: ## additionalBranchPrefix This value defaults to an empty string, and is typically not necessary. -Some managers populate this field for historical reasons, for example we use `docker-` for Docker branches, so they may look like `renovate/docker-ubuntu-16.x`. +Some managers previously populate this field, but they no longer do it by default. You normally don't need to configure this, but one example where it can be useful is combining with `parentDir` in monorepos to split PRs based on where the package definition is located, e.g. ```json diff --git a/docs/usage/configuration-templates.md b/docs/usage/configuration-templates.md index 10911f76f2857f..c239ac69fe898a 100644 --- a/docs/usage/configuration-templates.md +++ b/docs/usage/configuration-templates.md @@ -21,8 +21,7 @@ Most users will be happy with the default `branchPrefix` of `renovate/`, but you Say you don't want the forward slashes, in that case you would use `renovate-` as your `branchPrefix`. The onboarding PR will always use `renovate/configure`. -`additionalBranchPrefix` is optional and by default is empty for all JavaScript dependencies. -We use `docker-` for all Docker updates, branches will look like this: `renovate/docker-ubuntu-16.x`. +`additionalBranchPrefix` is optional and by default is empty. `branchTopic` depends on the package manager and upgrade type, so you will see a lot of variety. This is probably a setting you want to change yourself. diff --git a/lib/config/presets/index.ts b/lib/config/presets/index.ts index b3453affb237d6..ccfc6f58e6ae63 100644 --- a/lib/config/presets/index.ts +++ b/lib/config/presets/index.ts @@ -93,6 +93,7 @@ export function parsePreset(input: string): ParsedPreset { str = str.slice(0, str.indexOf('(')); } const presetsPackages = [ + 'compatibility', 'config', 'default', 'docker', diff --git a/lib/config/presets/internal/compatibility.ts b/lib/config/presets/internal/compatibility.ts new file mode 100644 index 00000000000000..8f7e50a9744e1d --- /dev/null +++ b/lib/config/presets/internal/compatibility.ts @@ -0,0 +1,21 @@ +import { Preset } from '../types'; + +export const presets: Record = { + additionalBranchPrefix: { + buildkite: { + additionalBranchPrefix: 'buildkite-', + }, + cargo: { + additionalBranchPrefix: 'rust-', + }, + docker: { + additionalBranchPrefix: 'docker-', + }, + helm: { + additionalBranchPrefix: 'helm-', + }, + homebrew: { + additionalBranchPrefix: 'homebrew-', + }, + }, +}; diff --git a/lib/config/presets/internal/index.ts b/lib/config/presets/internal/index.ts index fbbdd6a790ede3..e152b9747e19d7 100644 --- a/lib/config/presets/internal/index.ts +++ b/lib/config/presets/internal/index.ts @@ -1,4 +1,5 @@ import type { Preset, PresetConfig } from '../types'; +import * as compatibilityPreset from './compatibility'; import * as configPreset from './config'; import * as defaultPreset from './default'; import * as dockerPreset from './docker'; @@ -13,6 +14,7 @@ import * as schedulePreset from './schedule'; import * as workaroundsPreset from './workarounds'; export const groups: Record> = { + compatibility: compatibilityPreset.presets, config: configPreset.presets, default: defaultPreset.presets, docker: dockerPreset.presets, diff --git a/lib/datasource/docker/index.ts b/lib/datasource/docker/index.ts index 68ee2f26561082..91f4187e94305f 100644 --- a/lib/datasource/docker/index.ts +++ b/lib/datasource/docker/index.ts @@ -26,7 +26,6 @@ export const defaultVersioning = dockerVersioning.id; export const registryStrategy = 'first'; export const defaultConfig = { - additionalBranchPrefix: 'docker-', commitMessageTopic: '{{{depName}}} Docker tag', major: { enabled: false }, commitMessageExtra: diff --git a/lib/datasource/helm/index.ts b/lib/datasource/helm/index.ts index ea1105841ac2d0..af28e7caee5fbe 100644 --- a/lib/datasource/helm/index.ts +++ b/lib/datasource/helm/index.ts @@ -17,7 +17,6 @@ export const defaultRegistryUrls = ['https://charts.helm.sh/stable']; export const registryStrategy = 'first'; export const defaultConfig = { - additionalBranchPrefix: 'helm-', commitMessageTopic: 'Helm release {{depName}}', group: { commitMessageTopic: '{{{groupName}}} Helm releases', diff --git a/lib/manager/buildkite/index.ts b/lib/manager/buildkite/index.ts index a97b1018ed28c4..d678d7fd3c206d 100644 --- a/lib/manager/buildkite/index.ts +++ b/lib/manager/buildkite/index.ts @@ -7,5 +7,4 @@ export const defaultConfig = { commitMessageTopic: 'buildkite plugin {{depName}}', commitMessageExtra: 'to {{#if isMajor}}v{{{newMajor}}}{{else}}{{{newValue}}}{{/if}}', - additionalBranchPrefix: 'buildkite-', }; diff --git a/lib/manager/cargo/index.ts b/lib/manager/cargo/index.ts index e18f8527d5244c..e91db57470e3be 100644 --- a/lib/manager/cargo/index.ts +++ b/lib/manager/cargo/index.ts @@ -10,7 +10,6 @@ export { extractPackageFile, updateArtifacts, language }; export const defaultConfig = { commitMessageTopic: 'Rust crate {{depName}}', - additionalBranchPrefix: 'rust-', fileMatch: ['(^|/)Cargo.toml$'], versioning: cargoVersioning.id, rangeStrategy: 'bump', diff --git a/lib/manager/homebrew/index.ts b/lib/manager/homebrew/index.ts index 62bb3b08a55d92..b45e932cf7f9a7 100644 --- a/lib/manager/homebrew/index.ts +++ b/lib/manager/homebrew/index.ts @@ -3,6 +3,5 @@ export { updateDependency } from './update'; export const defaultConfig = { commitMessageTopic: 'Homebrew Formula {{depName}}', - additionalBranchPrefix: 'homebrew-', fileMatch: ['^Formula/[^/]+[.]rb$'], }; diff --git a/lib/workers/repository/updates/flatten.ts b/lib/workers/repository/updates/flatten.ts index 9a195d1d3e331d..877a91d86b9abe 100644 --- a/lib/workers/repository/updates/flatten.ts +++ b/lib/workers/repository/updates/flatten.ts @@ -27,14 +27,6 @@ export function applyUpdateConfig(input: BranchUpgradeConfig): any { .replace(/-+/, '-') .toLowerCase() : undefined; - if ( - updateConfig.language === LANGUAGE_DOCKER && - /(^|\/)node$/.exec(updateConfig.depName) && - updateConfig.depName !== 'calico/node' - ) { - updateConfig.additionalBranchPrefix = ''; - updateConfig.depNameSanitized = 'node'; - } generateBranchName(updateConfig); return updateConfig; } From a29d99a38c42e8742eb6920230ba3c0eee970ae9 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sat, 3 Apr 2021 09:36:30 +0200 Subject: [PATCH 2/4] fix lint --- lib/workers/repository/updates/flatten.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/workers/repository/updates/flatten.ts b/lib/workers/repository/updates/flatten.ts index 877a91d86b9abe..4e825084d6327d 100644 --- a/lib/workers/repository/updates/flatten.ts +++ b/lib/workers/repository/updates/flatten.ts @@ -4,7 +4,6 @@ import { getManagerConfig, mergeChildConfig, } from '../../../config'; -import { LANGUAGE_DOCKER } from '../../../constants/languages'; import { getDefaultConfig } from '../../../datasource'; import { get } from '../../../manager'; import { applyPackageRules } from '../../../util/package-rules'; From c251a6111ca055fedf65f2df0f377f31b61b4baf Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sat, 3 Apr 2021 09:40:48 +0200 Subject: [PATCH 3/4] fix helm test --- lib/config/presets/internal/compatibility.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/config/presets/internal/compatibility.ts b/lib/config/presets/internal/compatibility.ts index 8f7e50a9744e1d..ce1175f569fb34 100644 --- a/lib/config/presets/internal/compatibility.ts +++ b/lib/config/presets/internal/compatibility.ts @@ -11,11 +11,14 @@ export const presets: Record = { docker: { additionalBranchPrefix: 'docker-', }, - helm: { - additionalBranchPrefix: 'helm-', - }, homebrew: { additionalBranchPrefix: 'homebrew-', }, + packageRules: [ + { + matchDatasources: ['helm'], + additionalBranchPrefix: 'helm-', + }, + ], }, }; From f1443a108b5a8fa8940252e9e7975000047b205b Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sat, 3 Apr 2021 14:12:40 +0200 Subject: [PATCH 4/4] Update docs/usage/configuration-options.md Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> --- docs/usage/configuration-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index 1165cab962f4f8..c31c26c3784761 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -69,7 +69,7 @@ With the above config: ## additionalBranchPrefix This value defaults to an empty string, and is typically not necessary. -Some managers previously populate this field, but they no longer do it by default. +Some managers previously populated this field, but they no longer do so by default. You normally don't need to configure this, but one example where it can be useful is combining with `parentDir` in monorepos to split PRs based on where the package definition is located, e.g. ```json