Skip to content

Commit d39c33e

Browse files
committed
chore: add pac pipeline
1 parent 548d110 commit d39c33e

File tree

3 files changed

+166
-41
lines changed

3 files changed

+166
-41
lines changed

.builds/doc-pr-build.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.tekton/doc-pr-build.yaml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# 3. 创建 pr 触发的流水线以运行文档构建任务
2+
apiVersion: tekton.dev/v1
3+
kind: PipelineRun
4+
metadata:
5+
name: doc-pr-build
6+
annotations:
7+
pipelinesascode.tekton.dev/on-comment: "^(/doc-pr)$"
8+
pipelinesascode.tekton.dev/cancel-in-progress: "true"
9+
pipelinesascode.tekton.dev/max-keep-runs: "20"
10+
pipelinesascode.tekton.dev/on-cel-expression: |-
11+
(
12+
event == "pull_request" && (
13+
target_branch.matches("^(main|master|release-.*)$")
14+
)
15+
)
16+
spec:
17+
timeouts:
18+
pipeline: 1h
19+
tasks: 1h
20+
21+
params:
22+
- name: doc-base
23+
value: container_platform
24+
25+
# 下面这些变量都是 pac 触发时自动注入的
26+
- name: git-url
27+
value: "{{ repo_url }}"
28+
- name: git-revision
29+
value: "{{ source_branch }}"
30+
- name: git-commit
31+
value: "{{ revision }}"
32+
- name: pull-request-number
33+
value: "{{ pull_request_number }}"
34+
- name: pull-request-target
35+
value: "{{ target_branch }}"
36+
37+
pipelineRef:
38+
resolver: cluster
39+
params:
40+
- name: kind
41+
value: pipeline
42+
- name: name
43+
value: product-docs-pr-pipeline
44+
- name: namespace
45+
value: idp-dev
46+
47+
workspaces:
48+
- name: source
49+
volumeClaimTemplate:
50+
spec:
51+
storageClassName: topolvm
52+
accessModes:
53+
- ReadWriteOnce
54+
resources:
55+
requests:
56+
storage: 25Gi
57+
- name: cache
58+
persistentVolumeClaim:
59+
claimName: build-cache
60+
subPath: yarn_cache
61+
62+
# This secret will be replaced by the pac controller
63+
- name: basic-auth
64+
secret:
65+
secretName: "{{ git_auth_secret }}"
66+
67+
taskRunTemplate:
68+
# Default: run tasks as root (UID 0) since most build tasks require root privileges.
69+
# Individual tasks can override this as needed (see taskRunSpecs below).
70+
podTemplate:
71+
securityContext:
72+
runAsUser: 0
73+
runAsGroup: 0
74+
fsGroup: 0
75+
fsGroupChangePolicy: "OnRootMismatch"
76+
77+
taskRunSpecs:
78+
- pipelineTaskName: git-clone
79+
# Override: run git-clone as non-root user for security.
80+
podTemplate:
81+
securityContext:
82+
runAsUser: 65532
83+
runAsGroup: 65532
84+
fsGroup: 65532
85+
fsGroupChangePolicy: "OnRootMismatch"
86+
87+
- pipelineTaskName: build-docs
88+
computeResources:
89+
requests:
90+
cpu: 2
91+
memory: 6Gi
92+
limits:
93+
cpu: 4
94+
memory: 12Gi

.tekton/pr-manage.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
apiVersion: tekton.dev/v1
2+
kind: PipelineRun
3+
metadata:
4+
name: pr-manage
5+
annotations:
6+
pipelinesascode.tekton.dev/pipeline: "https://raw.githubusercontent.com/AlaudaDevops/toolbox/main/pr-cli/pipeline/pr-manage.yaml"
7+
pipelinesascode.tekton.dev/on-comment: "^/(help|rebase|lgtm|remove-lgtm|cherry-?pick|assign|merge|ready|unassign|label|unlabel|check|retest|close|batch|checkbox|checkbox-issue)($|\\s.*)"
8+
pipelinesascode.tekton.dev/max-keep-runs: "5"
9+
spec:
10+
pipelineRef:
11+
name: pr-manage
12+
params:
13+
- name: trigger_comment
14+
value: "{{ trigger_comment }}"
15+
- name: repo_owner
16+
value: "{{ repo_owner }}"
17+
- name: repo_name
18+
value: "{{ repo_name }}"
19+
- name: pull_request_number
20+
value: "{{ pull_request_number }}"
21+
- name: comment_sender
22+
value: "{{ sender }}"
23+
- name: git_auth_secret
24+
value: "{{ git_auth_secret }}"
25+
#
26+
# Optional parameters (value is the default):
27+
#
28+
# The key in git_auth_secret that contains the token (default: git-provider-token)
29+
# - name: git_auth_secret_key
30+
# value: "git-provider-token"
31+
#
32+
# Container image for pr-cli tool (default: registry.alauda.cn:60070/devops/toolbox/pr-cli:latest)
33+
# - name: image
34+
# value: "registry.alauda.cn:60070/devops/toolbox/pr-cli:latest"
35+
#
36+
# The /lgtm threshold needed of approvers for a PR to be approved (default: 1)
37+
# - name: lgtm_threshold
38+
# value: "1"
39+
#
40+
# The permissions the user need to trigger a lgtm (default: admin,write)
41+
# - name: lgtm_permissions
42+
# value: "admin,write"
43+
#
44+
# The review event when lgtm is triggered, can be APPROVE,
45+
# REQUEST_CHANGES, or COMMENT if setting to empty string it will be set as
46+
# PENDING (default: APPROVE)
47+
# - name: lgtm_review_event
48+
# value: "APPROVE"
49+
#
50+
# The merge method to use. Can be one of: merge, squash, rebase (default: squash)
51+
# - name: merge_method
52+
# value: "squash"
53+
#
54+
# The name used for self-check status (default: pr-manage)
55+
# - name: self_check_name
56+
# value: "pr-manage"
57+
#
58+
# Enable debug mode (skip validation, allow PR creator self-approval) (default: false)
59+
# - name: debug
60+
# value: "false"
61+
#
62+
# Enable verbose logging (debug level logs) (default: false)
63+
# - name: verbose
64+
# value: "false"
65+
#
66+
# The platform to use, can be one of: github, gitlab, gitee (default: github)
67+
# - name: platform
68+
# value: "github"
69+
#
70+
# The robot accounts for managing bot approval reviews.
71+
# - name: robot_accounts
72+
# value: "alaudabot,dependabot,renovate"

0 commit comments

Comments
 (0)