Skip to content

Commit

Permalink
feat(renovate): split trunk-base and release branches strategies
Browse files Browse the repository at this point in the history
feat(renovate): register node-version update in base
  • Loading branch information
kpanot committed Jan 27, 2025
1 parent e77dc8f commit 3819087
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 117 deletions.
14 changes: 13 additions & 1 deletion .renovaterc.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"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",
":labels(dependencies)"
],
"timezone": "Europe/Paris",
Expand Down Expand Up @@ -115,6 +114,19 @@
"io.swagger:swagger-codegen-cli"
],
"enabled": false
},
{
// TODO: replace the following matchers to `matchManagers` when https://github.com/renovatebot/renovate/issues/21760 is fixed
"matchDatasources": [
"node-version"
],
"matchFileNames": [
"**/.github/workflows/**/*.y{a,}ml",
"**/__dot__github/workflows/**/*.y{a,}ml",
"**/__empty__.github/workflows/**/*.y{a,}ml",
"**/action.y{a,}ml"
],
"enable": true
}
],
"customManagers": [
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) |
| **tasks/branching-strategy/release-branches** | | Rules to reduce impacted updates on release branches |
| **tasks/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/tasks/branching-strategy/release-branches",
// or "github>AmadeusITGroup/otter//tools/renovate/tasks/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",
"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": []
}
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"
}
]
}
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
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": [
"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/tasks/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/tasks/branching-strategy/release-branches",
"github>AmadeusITGroup/otter//tools/renovate/tasks/sdk-regenerate(yarn)",
"github>AmadeusITGroup/otter//tools/renovate/tasks/yarn-pnp"
]
Expand Down
72 changes: 72 additions & 0 deletions tools/renovate/tasks/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
}
]
}
6 changes: 6 additions & 0 deletions tools/renovate/tasks/branching-strategy/trunk-based.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "Rules to apply on trunk-based development",
"packageRules": [
]
}

0 comments on commit 3819087

Please sign in to comment.