generated from nyu-devops/project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from CSCI-GA-2820-FA23-001/webhook
add trigger and webhook
- Loading branch information
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
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,25 @@ | ||
apiVersion: triggers.tekton.dev/v1beta1 | ||
kind: EventListener | ||
metadata: | ||
name: cd-listener | ||
spec: | ||
serviceAccountName: pipeline | ||
triggers: | ||
- name: github-release | ||
interceptors: | ||
- ref: | ||
name: cel | ||
params: | ||
- name: filter | ||
value: "body.action == 'published'" | ||
- ref: | ||
name: "github" | ||
kind: ClusterInterceptor | ||
apiVersion: triggers.tekton.dev | ||
params: | ||
- name: "eventTypes" | ||
value: ["release"] | ||
bindings: | ||
- ref: cd-binding | ||
template: | ||
ref: cd-template |
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,15 @@ | ||
kind: Route | ||
apiVersion: route.openshift.io/v1 | ||
metadata: | ||
name: cd-pipeline | ||
labels: | ||
app.kubernetes.io/managed-by: EventListener | ||
app.kubernetes.io/part-of: Triggers | ||
eventlistener: cd-listener | ||
spec: | ||
to: | ||
kind: Service | ||
name: el-cd-listener | ||
tls: {} | ||
port: | ||
targetPort: http-listener |
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,17 @@ | ||
apiVersion: triggers.tekton.dev/v1beta1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: cd-binding | ||
spec: | ||
params: | ||
- name: git-repo-url | ||
value: $(body.repository.clone_url) | ||
- name: git-repo-name | ||
value: $(body.repository.name) | ||
- name: git-revision | ||
# use release tag name | ||
value: $(body.release.tag_name) | ||
- name: git-ref | ||
# use release tag name | ||
value: $(body.release.tag_name) | ||
|
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,37 @@ | ||
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 | ||
- name: git-ref | ||
description: The name of git branch or tag | ||
|
||
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: GIT_REF | ||
value: $(tt.params.git-ref) | ||
- 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 |