Skip to content

Commit

Permalink
feat(config): remove manager additionalBranchPrefix defaults (#9373)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rarkins committed Apr 22, 2021
1 parent 8af905e commit 13bbc5d
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/usage/configuration-options.md
Expand Up @@ -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 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
Expand Down
3 changes: 1 addition & 2 deletions docs/usage/configuration-templates.md
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions lib/config/presets/index.ts
Expand Up @@ -100,6 +100,7 @@ export function parsePreset(input: string): ParsedPreset {
str = str.slice(0, str.indexOf('('));
}
const presetsPackages = [
'compatibility',
'config',
'default',
'docker',
Expand Down
24 changes: 24 additions & 0 deletions lib/config/presets/internal/compatibility.ts
@@ -0,0 +1,24 @@
import { Preset } from '../types';

export const presets: Record<string, Preset> = {
additionalBranchPrefix: {
buildkite: {
additionalBranchPrefix: 'buildkite-',
},
cargo: {
additionalBranchPrefix: 'rust-',
},
docker: {
additionalBranchPrefix: 'docker-',
},
homebrew: {
additionalBranchPrefix: 'homebrew-',
},
packageRules: [
{
matchDatasources: ['helm'],
additionalBranchPrefix: 'helm-',
},
],
},
};
2 changes: 2 additions & 0 deletions 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';
Expand All @@ -13,6 +14,7 @@ import * as schedulePreset from './schedule';
import * as workaroundsPreset from './workarounds';

export const groups: Record<string, Record<string, Preset>> = {
compatibility: compatibilityPreset.presets,
config: configPreset.presets,
default: defaultPreset.presets,
docker: dockerPreset.presets,
Expand Down
1 change: 0 additions & 1 deletion lib/datasource/docker/index.ts
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion lib/datasource/helm/index.ts
Expand Up @@ -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',
Expand Down
1 change: 0 additions & 1 deletion lib/manager/buildkite/index.ts
Expand Up @@ -7,5 +7,4 @@ export const defaultConfig = {
commitMessageTopic: 'buildkite plugin {{depName}}',
commitMessageExtra:
'to {{#if isMajor}}v{{{newMajor}}}{{else}}{{{newValue}}}{{/if}}',
additionalBranchPrefix: 'buildkite-',
};
1 change: 0 additions & 1 deletion lib/manager/cargo/index.ts
Expand Up @@ -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',
Expand Down
1 change: 0 additions & 1 deletion lib/manager/homebrew/index.ts
Expand Up @@ -3,6 +3,5 @@ export { updateDependency } from './update';

export const defaultConfig = {
commitMessageTopic: 'Homebrew Formula {{depName}}',
additionalBranchPrefix: 'homebrew-',
fileMatch: ['^Formula/[^/]+[.]rb$'],
};
9 changes: 0 additions & 9 deletions lib/workers/repository/updates/flatten.ts
Expand Up @@ -4,7 +4,6 @@ import {
mergeChildConfig,
} from '../../../config';
import type { RenovateConfig } from '../../../config/types';
import { LANGUAGE_DOCKER } from '../../../constants/languages';
import { getDefaultConfig } from '../../../datasource';
import { get } from '../../../manager';
import { applyPackageRules } from '../../../util/package-rules';
Expand All @@ -27,14 +26,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;
}
Expand Down

0 comments on commit 13bbc5d

Please sign in to comment.