Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(renovate): split trunk-base and release branches strategies #2743

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .renovaterc.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"extends": [
"github>AmadeusITGroup/otter//tools/renovate/base",
"github>AmadeusITGroup/otter//tools/renovate/group/design-factory",
"github>AmadeusITGroup/otter//tools/renovate/managers/github-node-version.json5",
fpaul-1A marked this conversation as resolved.
Show resolved Hide resolved
"github>AmadeusITGroup/otter//tools/renovate/branching-strategy/release-branches",
":labels(dependencies)"
],
"timezone": "Europe/Paris",
Expand Down
37 changes: 23 additions & 14 deletions tools/renovate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ Otter framework provides a set of Renovate presets to facilitate the setup and r

## Available presets

| Preset | Parameters | Description |
|-------------------------------|------------------------------------|----------------------------------------------------------------------------------------------------|
| **group/design-factory** | | Group the dependencies related to Design Factory |
| **group/otter** | | Group the dependencies related to Otter |
| **group/sdk-spec** | spec-package-name | Create a dedicated group for the SDK spec (when fetching the spec from an NPM repository) |
| **tasks/base** | | Trigger post-install script when upgrading the package manager |
| **tasks/otter-ng-update** | package-manager (optional) | Trigger the migration scripts when upgrading the Otter dependencies |
| **tasks/sdk-regenerate** | package-manager (optional) | Regenerate the SDK when upgrading the SDK dependencies |
| **tasks/sdk-spec-regenerate** | package-manager, spec-package-name | Regenerate the SDK when upgrading the SDK spec (when fetching the spec from an NPM repository) |
| **tasks/yarn-pnp** | | **(Yarn only)** Upgrade Yarn SDKs when upgrading the version of Yarn (only relevant with PnP) |
| **base** | | Base configuration recommended for any project |
| **otter-project** | | **(Yarn only)** Additional configuration recommended for an Otter-based project |
| **sdk** | | **(Yarn only)** Additional configuration recommended for an SDK project |
| **sdk-spec-upgrade** | spec-package-name | **(Yarn only)** Additional configuration recommended when fetching the spec from an NPM repository |
| Preset | Parameters | Description |
| --------------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------- |
| **group/design-factory** | | Group the dependencies related to Design Factory |
| **group/otter** | | Group the dependencies related to Otter |
| **group/sdk-spec** | spec-package-name | Create a dedicated group for the SDK spec (when fetching the spec from an NPM repository) |
| **group/angular** | | Group all Angular dependencies |
| **group/typescript** | | Group all Typescript dependenciesmanager |
| **tasks/base** | | Trigger post-install script when upgrading the package manager |
| **tasks/otter-ng-update** | package-manager (optional) | Trigger the migration scripts when upgrading the Otter dependencies |
| **tasks/sdk-regenerate** | package-manager (optional) | Regenerate the SDK when upgrading the SDK dependencies |
| **tasks/sdk-spec-regenerate** | package-manager, spec-package-name | Regenerate the SDK when upgrading the SDK spec (when fetching the spec from an NPM repository) |
| **branching-strategy/release-branches** | | Rules to reduce impacted updates on release branches |
| **branching-strategy/trunk-based** | | Rules to apply on trunk-based development |
| **tasks/yarn-pnp** | | **(Yarn only)** Upgrade Yarn SDKs when upgrading the version of Yarn (only relevant with PnP) |
| **base** | | Base configuration recommended for any project |
| **otter-project** | | **(Yarn only)** Additional configuration recommended for an Otter-based project |
| **sdk** | | **(Yarn only)** Additional configuration recommended for an SDK project |
| **sdk-spec-upgrade** | spec-package-name | **(Yarn only)** Additional configuration recommended when fetching the spec from an NPM repository |

## Recommended setup

Expand All @@ -39,13 +43,16 @@ Otter framework provides a set of Renovate presets to facilitate the setup and r
```

If you are using npm package manager instead of yarn:

```json5
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>AmadeusITGroup/otter//tools/renovate/base",
"github>AmadeusITGroup/otter//tools/renovate/group/otter",
"github>AmadeusITGroup/otter//tools/renovate/tasks/base",
"github>AmadeusITGroup/otter//tools/renovate/branching-strategy/release-branches",
// or "github>AmadeusITGroup/otter//tools/renovate/branching-strategy/trunk-based" if your repo is based on Trunk-based Development
"github>AmadeusITGroup/otter//tools/renovate/tasks/otter-ng-update(npm)"
]
}
Expand All @@ -64,6 +71,7 @@ If you are using npm package manager instead of yarn:
```

If you are using Renovate to update your swagger spec files:

```json5
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
Expand All @@ -76,6 +84,7 @@ If you are using Renovate to update your swagger spec files:
```

If you are using npm package manager instead of yarn:

```json5
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
Expand Down
89 changes: 8 additions & 81 deletions tools/renovate/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"group:recommended",
"group:test",
"group:linters",
"helpers:pinGitHubActionDigestsToSemver"
"helpers:pinGitHubActionDigestsToSemver",
":automergeMinor",
cpaulve-1A marked this conversation as resolved.
Show resolved Hide resolved
kpanot marked this conversation as resolved.
Show resolved Hide resolved
"github>AmadeusITGroup/otter//tools/renovate/group/angular",
"github>AmadeusITGroup/otter//tools/renovate/group/typescript",
"github>AmadeusITGroup/otter//tools/renovate/managers/github-node-version.json5"
],
"hostRules": [
{
Expand All @@ -28,7 +32,8 @@
],
"updateInternalDeps": true,
"postUpdateOptions": [
"yarnDedupeHighest"
"yarnDedupeHighest",
"npmDedupe"
],
"labels": [
"dependencies"
Expand All @@ -41,83 +46,5 @@
"before 4am on monday"
]
},
"packageRules": [
{
"matchPackagePatterns": [
"*"
],
"automerge": true,
"rangeStrategy": "replace"
},
{
"matchPackagePatterns": [
"^@angular",
"^ng-packagr",
"^@schematics",
"angular",
"^@ngrx",
"^zone.js",
"^@nrwl",
"^@nx",
"^nx"
],
"groupName": "Angular dependencies",
"groupSlug": "angular-dependencies"
},
{
"matchPackagePatterns": [
"typescript",
"tslib"
],
"groupName": "Typescript dependencies",
"groupSlug": "typescript-dependencies"
},
{
"matchPackageNames": [
"typescript"
],
"rangeStrategy": "in-range-only"
},
{
"matchUpdateTypes": [
"major"
],
"matchBaseBranches": [
"main",
"master",
"/^release/"
],
"enabled": false
},
{
"matchUpdateTypes": [
"major",
"minor"
],
"matchBaseBranches": [
"/^release/"
],
"enabled": false
},
{
"matchPackageNames": [
"typescript"
],
"matchBaseBranches": [
"/.*-next$/"
],
"rangeStrategy": "replace"
},
{
"matchUpdateTypes": [
"major"
],
"matchBaseBranches": [
"/.*-next$/"
],
"groupName": "Major dependencies",
"groupSlug": "major-dependencies",
"enabled": true
}
]
"packageRules": []
}
10 changes: 10 additions & 0 deletions tools/renovate/branching-strategy/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Renovate branching strategy rules

This folder contains the 2 set of rules according to the branching strategy put in place in the repository:

- [Release Branches](./release-branches.json) reducing the breaking changes and minor updates on release branches
- [Trunk Based Development](./trunk-based.json) permissive regarding the update on current main branch.

> [!WARNING]
> The major updates of any Node.Js version are currently allowed in [Release Branches rules](./release-branches.json).
> This will be reduced to only the Node.Js version used in Github Actions when the [issue relative to custom manager](https://github.com/renovatebot/renovate/issues/21760) will be fixed.
72 changes: 72 additions & 0 deletions tools/renovate/branching-strategy/release-branches.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "Rules to reduce impacted updates on release branches",
"packageRules": [
{
"matchPackagePatterns": [
"*"
],
"rangeStrategy": "replace"
},
{
"matchPackageNames": [
"typescript"
],
"rangeStrategy": "in-range-only"
},
{
"matchUpdateTypes": [
"major"
],
"matchBaseBranches": [
"main",
"master",
"/^release/"
],
"enabled": false
},
{
"matchUpdateTypes": [
"major"
],
"matchDatasources": [
"node-version"
],
"matchBaseBranches": [
"main",
"master"
],
"enabled": true
},
{
"matchUpdateTypes": [
"major",
"minor"
],
"matchBaseBranches": [
"/^release/"
],
"enabled": false
},
{
"matchPackageNames": [
"typescript"
],
"matchBaseBranches": [
"/.*-next$/"
],
"rangeStrategy": "replace"
},
{
"matchUpdateTypes": [
"major"
],
"matchBaseBranches": [
"/.*-next$/"
],
"groupName": "Major dependencies",
"groupSlug": "major-dependencies",
"enabled": true
}
]
}
14 changes: 14 additions & 0 deletions tools/renovate/branching-strategy/trunk-based.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "Rules to apply on trunk-based development",
"packageRules": [
{
"matchBaseBranches": [
"main",
"master",
"develop"
],
"rangeStrategy": "replace"
}
]
}
21 changes: 21 additions & 0 deletions tools/renovate/group/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "Group all Angular dependencies",
"packageRules": [
{
"matchPackagePatterns": [
"^@angular",
"^ng-packagr",
"^@schematics",
"angular",
"^@ngrx",
"^zone.js",
"^@nrwl",
"^@nx",
"^nx"
],
"groupName": "Angular dependencies",
"groupSlug": "angular-dependencies"
}
]
}
1 change: 1 addition & 0 deletions tools/renovate/group/design-factory.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{
"matchPackagePatterns": [
"bootstrap",
"^@ng-select",
"^ag-grid-",
"^@design-factory",
"^@agnos-ui",
Expand Down
14 changes: 14 additions & 0 deletions tools/renovate/group/typescript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "Group all Typescript dependencies",
"packageRules": [
{
"matchPackagePatterns": [
"typescript",
"tslib"
],
"groupName": "Typescript dependencies",
"groupSlug": "typescript-dependencies"
}
]
}
21 changes: 0 additions & 21 deletions tools/renovate/managers/github-node-version.json5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessarily linked to this PR but it would be nice to group this upgrade and the npm upgrade of @types/node in the same group

Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,5 @@
"datasourceTemplate": "node-version",
"versioningTemplate": "node"
}
],
"packageRules": [
{
// TODO: replace the following matchers to `matchManagers` when https://github.com/renovatebot/renovate/issues/21760 is fixed
"matchDatasources": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we remove these lines from the preset?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not exactly removed, it is part of rules on node-version in release-branches.json

"node-version"
],
"matchFileNames": [
"**/.github/workflows/**/*.y{a,}ml",
"**/__dot__github/workflows/**/*.y{a,}ml",
"**/__empty__.github/workflows/**/*.y{a,}ml",
"**/action.y{a,}ml"
],

"matchBaseBranches": [
"main",
"master",
"develop"
],
"enable": true
}
]
}
1 change: 1 addition & 0 deletions tools/renovate/otter-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"extends": [
"github>AmadeusITGroup/otter//tools/renovate/group/otter",
"github>AmadeusITGroup/otter//tools/renovate/tasks/base",
"github>AmadeusITGroup/otter//tools/renovate/branching-strategy/release-branches",
"github>AmadeusITGroup/otter//tools/renovate/tasks/otter-ng-update(yarn)",
"github>AmadeusITGroup/otter//tools/renovate/tasks/yarn-pnp"
]
Expand Down
1 change: 1 addition & 0 deletions tools/renovate/sdk.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"extends": [
"github>AmadeusITGroup/otter//tools/renovate/group/otter",
"github>AmadeusITGroup/otter//tools/renovate/tasks/base",
"github>AmadeusITGroup/otter//tools/renovate/branching-strategy/release-branches",
"github>AmadeusITGroup/otter//tools/renovate/tasks/sdk-regenerate(yarn)",
"github>AmadeusITGroup/otter//tools/renovate/tasks/yarn-pnp"
]
Expand Down
Loading