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(apps/prod/tekton/config/triggers): add triggers for pingcap-qe/artifacts #708

Merged
merged 1 commit into from
Oct 18, 2023
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
name: github-branch-create
spec:
params:
- name: git-url
value: $(body.repository.url)
- name: git-ref
value: $(body.ref)
12 changes: 12 additions & 0 deletions apps/prod/tekton/configs/triggers/bindings/github-branch-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
name: github-branch-push
spec:
params:
- name: git-url
value: $(body.repository.url)
- name: git-revision
value: $(body.head_commit.id)
- name: git-ref
value: $(body.ref)
8 changes: 6 additions & 2 deletions apps/prod/tekton/configs/triggers/bindings/github-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ metadata:
name: github-pr
spec:
params:
- name: git-revision
value: $(body.pull_request.head.sha)
- name: git-url
value: $(body.pull_request.head.repo.clone_url)
- name: git-revision
value: $(body.pull_request.head.sha)
- name: pr-number
value: $(body.pull_request.number)
- name: pr-title
value: $(body.pull_request.title)
- name: pr-body
value: $(body.pull_request.body)
- name: pr-user
value: $(body.pull_request.user.login)
- name: pr-head-owner
Expand Down
12 changes: 12 additions & 0 deletions apps/prod/tekton/configs/triggers/bindings/github-tag-create.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
name: github-tag-create
spec:
params:
- name: git-url
value: $(body.repository.url)
- name: git-ref
value: $(body.ref)
- name: git-tag
value: $(body.ref)
3 changes: 3 additions & 0 deletions apps/prod/tekton/configs/triggers/bindings/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github-pr.yaml
- github-branch-create.yaml
- github-branch-push.yaml
- github-tag-create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ spec:
interceptors:
- name: "filter on eventType"
ref:
# name of the clusterinterceptor
name: github
params:
# - name: secretRef
# value:
# secretName: github-secret
# secretKey: secretToken
- name: eventTypes
value: ["pull_request"]
- name: "validate PR state and add field"
Expand All @@ -32,3 +27,66 @@ spec:
labelSelector:
matchLabels:
type: github-pr
- name: github-branch-push
interceptors:
- name: "filter on eventType"
ref:
name: github
params:
- name: eventTypes
value: ["push"]
- name: "validate branch push"
ref:
name: cel
params:
- name: filter
value: body.ref_type == 'branch'
triggerSelector:
namespaceSelector:
matchNames:
- ee-cd
labelSelector:
matchLabels:
type: github-branch-push
- name: github-branch-create
interceptors:
- name: "filter on eventType"
ref:
name: github
params:
- name: eventTypes
value: ["create"]
- name: "validate branch create"
ref:
name: cel
params:
- name: filter
value: body.ref_type == 'branch'
triggerSelector:
namespaceSelector:
matchNames:
- ee-cd
labelSelector:
matchLabels:
type: github-branch-create
- name: github-tag-create
interceptors:
- name: "filter on eventType"
ref:
name: github
params:
- name: eventTypes
value: ["create"]
- name: "validate tag create"
ref:
name: cel
params:
- name: filter
value: body.ref_type == 'tag'
triggerSelector:
namespaceSelector:
matchNames:
- ee-cd
labelSelector:
matchLabels:
type: github-tag-create
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:
name: branch-create-pingcap-qe-artifacts
spec:
params:
- name: git-url
description: The git repository full url
- name: git-revision
description: The git revision
default: main
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: post-pingcap-qe-artifacts-run-
annotations:
"tekton.dev/git-status": "true"
"tekton.dev/status-context": "demo-pipeline1"
"tekton.dev/status-description": "demo pipeline forwarded by prow"
"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:
pipelineSpec:
params:
- name: git-url
type: string
- name: git-revision
default: main
type: string
tasks:
- name: echo-good-morning
taskSpec:
metadata: {}
spec: null
steps:
- image: ubuntu
name: echo
resources: {}
script: |
#!/usr/bin/env bash
echo "Good Morning!"
- name: checkout
params:
- name: url
value: $(params.git-url)
- name: revision
value: $(params.git-revision)
taskRef:
kind: Task
name: git-clone
workspaces:
- name: output
workspace: git-source
- name: echo-good-afternoon
taskSpec:
metadata: {}
spec: null
steps:
- image: ubuntu
name: echo
resources: {}
script: |
#!/usr/bin/env bash
echo "Good Afternoon!"
params:
- name: git-url
value: $(tt.params.git-url)
- name: git-revision
value: $(tt.params.git-revision)
workspaces:
- name: git-source
volumeClaimTemplate:
spec:
storageClassName: nfs
accessModes: [ReadWriteMany]
resources:
requests:
storage: 1Gi
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- branch-create-pingcap-qe-artifacts.yaml
- pull-pingcap-qe-artifacts.yaml
- push-pingcap-qe-artifacts.yaml
- tag-create-pingcap-qe-artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:
name: push-pingcap-qe-artifacts
spec:
params:
- name: git-url
description: The git repository full url
- name: git-revision
description: The git revision
default: main
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: post-pingcap-qe-artifacts-run-
annotations:
"tekton.dev/git-status": "true"
"tekton.dev/status-context": "demo-pipeline1"
"tekton.dev/status-description": "demo pipeline forwarded by prow"
"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:
pipelineSpec:
params:
- name: git-url
type: string
- name: git-revision
default: main
type: string
tasks:
- name: echo-good-morning
taskSpec:
metadata: {}
spec: null
steps:
- image: ubuntu
name: echo
resources: {}
script: |
#!/usr/bin/env bash
echo "Good Morning!"
- name: checkout
params:
- name: url
value: $(params.git-url)
- name: revision
value: $(params.git-revision)
taskRef:
kind: Task
name: git-clone
workspaces:
- name: output
workspace: git-source
- name: echo-good-afternoon
taskSpec:
metadata: {}
spec: null
steps:
- image: ubuntu
name: echo
resources: {}
script: |
#!/usr/bin/env bash
echo "Good Afternoon!"
params:
- name: git-url
value: $(tt.params.git-url)
- name: git-revision
value: $(tt.params.git-revision)
workspaces:
- name: git-source
volumeClaimTemplate:
spec:
storageClassName: nfs
accessModes: [ReadWriteMany]
resources:
requests:
storage: 1Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:
name: tag-create-pingcap-qe-artifacts
spec:
params:
- name: git-url
description: The git repository full url
- name: git-revision
description: The git revision
default: main
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: post-pingcap-qe-artifacts-run-
annotations:
"tekton.dev/git-status": "true"
"tekton.dev/status-context": "demo-pipeline1"
"tekton.dev/status-description": "demo pipeline forwarded by prow"
"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:
pipelineSpec:
params:
- name: git-url
type: string
- name: git-revision
default: main
type: string
tasks:
- name: echo-good-morning
taskSpec:
metadata: {}
spec: null
steps:
- image: ubuntu
name: echo
resources: {}
script: |
#!/usr/bin/env bash
echo "Good Morning!"
- name: checkout
params:
- name: url
value: $(params.git-url)
- name: revision
value: $(params.git-revision)
taskRef:
kind: Task
name: git-clone
workspaces:
- name: output
workspace: git-source
- name: echo-good-afternoon
taskSpec:
metadata: {}
spec: null
steps:
- image: ubuntu
name: echo
resources: {}
script: |
#!/usr/bin/env bash
echo "Good Afternoon!"
params:
- name: git-url
value: $(tt.params.git-url)
- name: git-revision
value: $(tt.params.git-revision)
workspaces:
- name: git-source
volumeClaimTemplate:
spec:
storageClassName: nfs
accessModes: [ReadWriteMany]
resources:
requests:
storage: 1Gi
Loading