-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(apps/prod/tekton/configs): add task and triggers for auto sync O…
…WNERS for hotfix branches (#737) * fix(apps/prod/tekton/configs/triggers/bindings): fix branch and tag bindings - tag creating event - branch creating event - branch pushing event Signed-off-by: wuhuizuo <wuhuizuo@126.com> * Update apps/prod/tekton/configs/triggers/bindings/github-branch-create.yaml * feat(apps/prod/tekton/configs): add task and triggers for auto sync OWNERS for hotfix branches Automatically create pull requests when hot fix branch is created. Signed-off-by: wuhuizuo <wuhuizuo@126.com> * Update apps/prod/tekton/configs/triggers/templates/branch-create-product-components-hotfix.yaml * Update apps/prod/tekton/configs/triggers/triggers/create-branch-product-components-hotfix.yaml * Update apps/prod/tekton/configs/triggers/triggers/create-branch-product-components-hotfix.yaml --------- Signed-off-by: wuhuizuo <wuhuizuo@126.com>
- Loading branch information
Showing
7 changed files
with
147 additions
and
11 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
apps/prod/tekton/configs/tasks/create-pr-to-sync-owners.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: create-pr-to-sync-owners | ||
labels: | ||
app.kubernetes.io/version: "0.1" | ||
annotations: | ||
tekton.dev/pipelines.minVersion: "0.29.0" | ||
tekton.dev/categories: Deno | ||
tekton.dev/tags: deno | ||
tekton.dev/displayName: "sync owners" | ||
tekton.dev/platforms: "linux/amd64" | ||
spec: | ||
description: >- | ||
Create pull request to sync `OWNERS`` file to github repository branch. | ||
params: | ||
- name: git-url | ||
description: repository clone url | ||
type: string | ||
- name: branch | ||
description: branch name | ||
type: string | ||
steps: | ||
- name: clone-community-repo | ||
image: bitnami/git:latest | ||
workingDir: /workspace | ||
script: | | ||
git clone https://github.com/pingcap/community.git --branch master | ||
- name: create-pull-request | ||
image: denoland/deno:1.37.2 | ||
workingDir: /workspace/community | ||
script: | | ||
owner=$(basename $(dirname $(params.git-url))) | ||
repo=$(basename $(params.git-url) .git) | ||
echo "url=$(params.git-url)" | ||
echo "branch=$(params.branch)" | ||
echo "owner=${owner}" | ||
echo "repo=${repo}" | ||
deno run --allow-all https://github.com/PingCAP-QE/ci/raw/main/scripts/pingcap/community/update-prow-owners.ts \ | ||
--force \ | ||
--owner=${owner} \ | ||
--github_private_token=$(cat /etc/github/token) \ | ||
--only_repo.repo=${repo} \ | ||
--only_repo.branch=$(params.branch) \ | ||
--inputs=teams/diagnostic/membership.json \ | ||
--inputs=teams/docs/membership.json \ | ||
--inputs=teams/tiunimanager/membership.json \ | ||
--inputs=teams/tidb/membership.json \ | ||
--inputs=teams/tiflash/membership.json \ | ||
--inputs=teams/tiup/membership.json \ | ||
--inputs=teams/kubernetes/membership.json \ | ||
--inputs=teams/migration/membership.json \ | ||
--inputs=teams/bigdata/membership.json | ||
workspaces: | ||
- name: github | ||
description: Must includes a key `token` | ||
mountPath: /etc/github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
apps/prod/tekton/configs/triggers/templates/branch-create-product-components-hotfix.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: triggers.tekton.dev/v1beta1 | ||
kind: TriggerTemplate | ||
metadata: | ||
name: branch-create-product-components-hotfix | ||
spec: | ||
params: | ||
- name: git-url | ||
description: The git repository full url | ||
- name: git-ref | ||
description: The git ref | ||
default: main | ||
resourcetemplates: | ||
- apiVersion: tekton.dev/v1beta1 | ||
kind: TaskRun | ||
metadata: | ||
generateName: branch-create-product-components-hotfix-run- | ||
annotations: | ||
"tekton.dev/git-status": "true" | ||
"tekton.dev/status-target-url": | ||
"https://do.pingcap.net/tekton/#/namespaces/{{ .Namespace }}/pipelineruns/{{ .Name }}" | ||
"tekton.dev/git-repo": $(tt.params.git-url) | ||
"tekton.dev/git-revision": $(tt.params.git-revision) | ||
spec: | ||
params: | ||
- name: git-url | ||
value: $(tt.params.git-url) | ||
- name: branch | ||
value: $(tt.params.git-ref) | ||
taskRef: | ||
kind: Task | ||
name: create-pr-to-sync-owners | ||
podTemplate: | ||
nodeSelector: | ||
kubernetes.io/arch: "amd64" | ||
workspaces: | ||
- name: github | ||
secret: | ||
secretName: github |
38 changes: 38 additions & 0 deletions
38
apps/prod/tekton/configs/triggers/triggers/create-branch-product-components-hotfix.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: triggers.tekton.dev/v1beta1 | ||
kind: Trigger | ||
metadata: | ||
name: branch-create-product-components-hotfix | ||
labels: | ||
type: github-branch-create | ||
spec: | ||
interceptors: | ||
- name: filter on repo owner and name | ||
ref: | ||
name: cel | ||
params: | ||
- name: filter | ||
value: >- | ||
body.repository.owner.login == 'pingcap' && body.repository.name in [ | ||
'tidb', | ||
'tiflash', | ||
'tiflow', | ||
'tidb-binlog', | ||
'tidb-dashboard', | ||
'tidb-tools' | ||
] | ||
# filter git refs that match regexp: ^refs/heads/release-\d+\.\d+-\d+-v\d+\.\d+\.\d+$ | ||
# example values of `body.ref`: | ||
# refs/heads/release-6.5-20231020-v6.5.5 | ||
# refs/heads/release-6.5-20231020-v6.5.5-1 | ||
- name: filter on branch names | ||
ref: | ||
name: cel | ||
params: | ||
- name: filter | ||
value: >- | ||
body.ref.matches('^refs/heads/release-\\d+\\.\\d+-\\d+-v\\d+\\.\\d+\\.\\d+(-.+)?$') | ||
bindings: | ||
- ref: github-branch-create | ||
template: | ||
ref: branch-create-product-components-hotfix |