Skip to content

Commit 43e9339

Browse files
committed
Add CI and GitHub configuration for release-2.0 branch
Add backport workflow job, dependabot config, labels, auto-labeling rules, and weekly security scans for the new release-2.0 branch.
1 parent 1b77db8 commit 43e9339

5 files changed

Lines changed: 109 additions & 1 deletion

File tree

.github/dependabot.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,44 @@ updates:
8484
- dependency-name: "k8s.io/*"
8585
update-types: ["version-update:semver-major", "version-update:semver-minor"]
8686
## release-1.0 branch config ends here
87+
## release-2.0 branch config starts here
88+
# github-actions
89+
- directory: "/"
90+
package-ecosystem: "github-actions"
91+
schedule:
92+
interval: "weekly"
93+
day: "monday"
94+
cooldown:
95+
default-days: 7
96+
target-branch: release-2.0
97+
groups:
98+
all-github-actions:
99+
patterns: [ "*" ]
100+
commit-message:
101+
prefix: ":seedling:"
102+
include: scope
103+
# Go directories
104+
- directories:
105+
- "/"
106+
package-ecosystem: "gomod"
107+
schedule:
108+
interval: "weekly"
109+
day: "monday"
110+
cooldown:
111+
default-days: 7
112+
target-branch: release-2.0
113+
groups:
114+
all-go-mod-patch-and-minor:
115+
patterns: [ "*" ]
116+
update-types: [ "patch", "minor" ]
117+
commit-message:
118+
prefix: ":seedling:"
119+
include: scope
120+
ignore:
121+
# Ignore controller-runtime major and minor bumps as its upgraded manually.
122+
- dependency-name: "sigs.k8s.io/controller-runtime"
123+
update-types: ["version-update:semver-major", "version-update:semver-minor"]
124+
# Ignore k8s major and minor bumps and its transitives modules
125+
- dependency-name: "k8s.io/*"
126+
update-types: ["version-update:semver-major", "version-update:semver-minor"]
127+
## release-2.0 branch config ends here

.github/labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
v1.0:
22
- base-branch: 'release-1.0'
3+
v2.0:
4+
- base-branch: 'release-2.0'

.github/labels.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
- color: '30ABB9'
55
description: This PR targets v1.0
66
name: v1.0
7+
- color: 'D97706'
8+
description: This PR will be backported to v2.0
9+
name: backport-v2.0
10+
- color: 'D97706'
11+
description: This PR targets v2.0
12+
name: v2.0
713

814
- color: 'BCF611'
915
description: A good issue for first-time contributors

.github/workflows/backport.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,62 @@ jobs:
6969
NUMBER: ${{ github.event.pull_request.number }}
7070
BODY: >
7171
Labels `semver:major` and `semver:minor` block backports to the branch `release-1.0`.
72+
73+
backport_v2_0:
74+
name: "Backport to v2.0"
75+
# Only react to merged PRs for security reasons.
76+
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
77+
if: >
78+
github.event.pull_request.merged
79+
&& (
80+
github.event.action == 'closed'
81+
&& contains(github.event.pull_request.labels.*.name, 'backport-v2.0')
82+
|| (
83+
github.event.action == 'labeled'
84+
&& contains(github.event.label.name, 'backport-v2.0')
85+
)
86+
)
87+
runs-on: ubuntu-latest
88+
steps:
89+
- name: Generate a token from the orc-backport-bot github-app
90+
id: generate_token
91+
uses: getsentry/action-github-app-token@5c1e90706fe007857338ac1bfbd7a4177db2f789 # tag=v4.0.0
92+
with:
93+
app_id: ${{ secrets.BACKPORT_APP_ID }} # zizmor: ignore[secrets-outside-env]
94+
private_key: ${{ secrets.BACKPORT_APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env]
95+
96+
- name: Backporting
97+
if: >
98+
contains(github.event.pull_request.labels.*.name, 'semver:patch')
99+
|| contains(github.event.pull_request.labels.*.name, 'semver:minor')
100+
|| contains(github.event.label.name, 'semver:patch')
101+
|| contains(github.event.label.name, 'semver:minor')
102+
uses: kiegroup/git-backporting@08da0b07ef2330d189f6074ec8db736b3aa9f465 # tag=v4.9.1
103+
with:
104+
target-branch: release-2.0
105+
pull-request: ${{ github.event.pull_request.url }}
106+
auth: ${{ steps.generate_token.outputs.token }}
107+
no-squash: true
108+
strategy-option: find-renames
109+
110+
- name: Report failure
111+
if: failure()
112+
run: gh issue comment "$NUMBER" --body "$BODY"
113+
env:
114+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115+
GH_REPO: ${{ github.repository }}
116+
NUMBER: ${{ github.event.pull_request.number }}
117+
BODY: >
118+
Failed to backport PR to `release-2.0` branch. See [logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
119+
120+
- name: Report an error if backport unsupported labels
121+
if: >
122+
contains(github.event.pull_request.labels.*.name, 'semver:major')
123+
|| contains(github.event.label.name, 'semver:major')
124+
run: gh pr comment "$NUMBER" --body "$BODY"
125+
env:
126+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
GH_REPO: ${{ github.repository }}
128+
NUMBER: ${{ github.event.pull_request.number }}
129+
BODY: >
130+
Label `semver:major` blocks backports to the branch `release-2.0`.

.github/workflows/weekly-security-scan.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
branch: [main, release-1.0]
16+
branch: [main, release-1.0, release-2.0]
1717
name: Trivy
1818
runs-on: ubuntu-latest
1919
steps:

0 commit comments

Comments
 (0)