Skip to content

Commit

Permalink
update trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
KimHe-RGB committed Dec 13, 2023
1 parent fc6a2f5 commit 3421e5c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 28 deletions.
10 changes: 10 additions & 0 deletions .tekton/events/trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: triggers.tekton.dev/v1beta1
kind: Trigger
metadata:
name: cd-trigger
spec:
serviceAccountName: pipeline
bindings:
- ref: cd-binding
template:
ref: cd-template
34 changes: 6 additions & 28 deletions .tekton/events/trigger_binding.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
kind: TriggerBinding
metadata:
name: cd-template
name: cd-binding
spec:
params:
- name: git-repo-url
description: The git repository url
- name: git-revision
description: The git revision
value: $(body.repository.url)
- name: git-repo-name
description: The name of the deployment to be created / patched

resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
# tt refers to the trigger template
generateName: cd-pipeline-$(tt.params.git-repo-name)-
spec:
serviceAccountName: pipeline
pipelineRef:
name: cd-pipeline
params:
- name: APP_NAME
value: $(tt.params.git-repo-name)
- name: GIT_REPO
value: $(tt.params.git-repo-url)
- name: IMAGE_NAME
value: image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/$(tt.params.git-repo-name):$(tt.params.git-revision)
workspaces:
- name: pipeline-workspace
persistentVolumeClaim:
claimName: pipeline-pvc
value: $(body.repository.name)
- name: git-revision
value: $(body.head_commit.id)
33 changes: 33 additions & 0 deletions .tekton/events/trigger_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:
name: cd-template
spec:
params:
- name: git-repo-url
description: The git repository url
- name: git-revision
description: The git revision
- name: git-repo-name
description: The name of the deployment to be created / patched

resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: cd-pipeline-$(tt.params.git-repo-name)-
spec:
serviceAccountName: pipeline
pipelineRef:
name: cd-pipeline
params:
- name: APP_NAME
value: $(tt.params.git-repo-name)
- name: GIT_REPO
value: $(tt.params.git-repo-url)
- name: IMAGE_NAME
value: image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/$(tt.params.git-repo-name):$(tt.params.git-revision)
workspaces:
- name: pipeline-workspace
persistentVolumeClaim:
claimName: pipeline-pvc

0 comments on commit 3421e5c

Please sign in to comment.