From 15f7c37f2215971e3397a305debd53564b28e24c Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Sat, 2 May 2020 21:45:10 +0100 Subject: [PATCH] Added PR number to tekton pipelines --- tekton/bindings/gitea.yaml | 2 ++ tekton/pipelines/pr.yaml | 4 ++++ tekton/tasks/make.yaml | 10 ++++++++++ tekton/triggertemplates/pr.yaml | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/tekton/bindings/gitea.yaml b/tekton/bindings/gitea.yaml index 6666741..bd0f79f 100644 --- a/tekton/bindings/gitea.yaml +++ b/tekton/bindings/gitea.yaml @@ -17,3 +17,5 @@ spec: value: $(body.repository.name) - name: isprivate value: $(body.repository.private) + - name: prid + value: $(body.number) diff --git a/tekton/pipelines/pr.yaml b/tekton/pipelines/pr.yaml index 4ffa23f..4b3005c 100644 --- a/tekton/pipelines/pr.yaml +++ b/tekton/pipelines/pr.yaml @@ -69,6 +69,10 @@ spec: params: - name: TARGET value: "ci" + - name: REPO + value: $(params.projectname) + - name: PR_ID + value: $(params.prid) resources: inputs: - name: src diff --git a/tekton/tasks/make.yaml b/tekton/tasks/make.yaml index 1a52b46..4ce85d6 100644 --- a/tekton/tasks/make.yaml +++ b/tekton/tasks/make.yaml @@ -17,3 +17,13 @@ spec: image: docker.cluster.fun/averagemarcus/ci-builder:latest script: | make --dry-run -t $(params.TARGET) &> /dev/null && make $(params.TARGET) || echo "No '$(params.TARGET)' target found, skipping" + env: + - name: REPO + value: $(params.REPO) + - name: PR_ID + value: $(params.PR_ID) + - name: ACCESS_TOKEN + valueFrom: + secretKeyRef: + name: gitea-access-token + key: access-token diff --git a/tekton/triggertemplates/pr.yaml b/tekton/triggertemplates/pr.yaml index 61c5ea3..17ff6f3 100644 --- a/tekton/triggertemplates/pr.yaml +++ b/tekton/triggertemplates/pr.yaml @@ -15,6 +15,8 @@ spec: description: The ref of the PR - name: projectname description: The name of the git project + - name: prid + description: The number of the PR resourcetemplates: - apiVersion: tekton.dev/v1beta1 kind: PipelineRun @@ -31,6 +33,8 @@ spec: value: $(params.gitrevision) - name: projectname value: $(params.projectname) + - name: prid + value: $(params.prid) resources: - name: git-source resourceSpec: