Switch to using the commit hash from the fetch-repository step for gitea status.
All checks were successful
semver Build semver has succeeded
rustfmt Build rustfmt has succeeded
rust-test Build rust-test has succeeded

The PULL_BASE_SHA was sometimes being set as master which meant that if multiple commits came in, they'd all write their statuses to the newest one.
This commit is contained in:
Tom Alexander 2023-07-14 00:45:13 -04:00
parent 57ac625350
commit 4855d3b4f0
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 14 additions and 10 deletions

View File

@ -43,6 +43,8 @@ spec:
- name: report-pending - name: report-pending
taskRef: taskRef:
name: gitea-set-status name: gitea-set-status
runAfter:
- fetch-repository
params: params:
- name: CONTEXT - name: CONTEXT
value: "$(params.JOB_NAME)" value: "$(params.JOB_NAME)"
@ -51,7 +53,7 @@ spec:
- name: GITEA_HOST_URL - name: GITEA_HOST_URL
value: code.fizz.buzz value: code.fizz.buzz
- name: SHA - name: SHA
value: "$(params.PULL_BASE_SHA)" value: "$(tasks.fetch-repository.results.commit)"
- name: DESCRIPTION - name: DESCRIPTION
value: "Build $(params.JOB_NAME) has started" value: "Build $(params.JOB_NAME) has started"
- name: STATE - name: STATE
@ -76,7 +78,7 @@ spec:
name: kaniko name: kaniko
params: params:
- name: IMAGE - name: IMAGE
value: "$(params.image-name):$(params.PULL_BASE_SHA)" value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
- name: CONTEXT - name: CONTEXT
value: $(params.path-to-image-context) value: $(params.path-to-image-context)
- name: DOCKERFILE - name: DOCKERFILE
@ -116,7 +118,7 @@ spec:
- name: args - name: args
value: ["$(params.args[*])"] value: ["$(params.args[*])"]
- name: docker-image - name: docker-image
value: "$(params.image-name):$(params.PULL_BASE_SHA)" value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
finally: finally:
- name: report-success - name: report-success
when: when:
@ -133,7 +135,7 @@ spec:
- name: GITEA_HOST_URL - name: GITEA_HOST_URL
value: code.fizz.buzz value: code.fizz.buzz
- name: SHA - name: SHA
value: "$(params.PULL_BASE_SHA)" value: "$(tasks.fetch-repository.results.commit)"
- name: DESCRIPTION - name: DESCRIPTION
value: "Build $(params.JOB_NAME) has succeeded" value: "Build $(params.JOB_NAME) has succeeded"
- name: STATE - name: STATE
@ -155,7 +157,7 @@ spec:
- name: GITEA_HOST_URL - name: GITEA_HOST_URL
value: code.fizz.buzz value: code.fizz.buzz
- name: SHA - name: SHA
value: "$(params.PULL_BASE_SHA)" value: "$(tasks.fetch-repository.results.commit)"
- name: DESCRIPTION - name: DESCRIPTION
value: "Build $(params.JOB_NAME) has failed" value: "Build $(params.JOB_NAME) has failed"
- name: STATE - name: STATE

View File

@ -51,6 +51,8 @@ spec:
- name: report-pending - name: report-pending
taskRef: taskRef:
name: gitea-set-status name: gitea-set-status
runAfter:
- fetch-repository
params: params:
- name: CONTEXT - name: CONTEXT
value: "$(params.JOB_NAME)" value: "$(params.JOB_NAME)"
@ -59,7 +61,7 @@ spec:
- name: GITEA_HOST_URL - name: GITEA_HOST_URL
value: code.fizz.buzz value: code.fizz.buzz
- name: SHA - name: SHA
value: "$(params.PULL_BASE_SHA)" value: "$(tasks.fetch-repository.results.commit)"
- name: DESCRIPTION - name: DESCRIPTION
value: "Build $(params.JOB_NAME) has started" value: "Build $(params.JOB_NAME) has started"
- name: STATE - name: STATE
@ -92,7 +94,7 @@ spec:
name: kaniko name: kaniko
params: params:
- name: IMAGE - name: IMAGE
value: "$(params.image-name):$(params.PULL_BASE_SHA)" value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
- name: CONTEXT - name: CONTEXT
value: $(params.path-to-image-context) value: $(params.path-to-image-context)
- name: DOCKERFILE - name: DOCKERFILE
@ -131,7 +133,7 @@ spec:
- name: args - name: args
value: ["$(params.args[*])"] value: ["$(params.args[*])"]
- name: docker-image - name: docker-image
value: "$(params.image-name):$(params.PULL_BASE_SHA)" value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
- name: commit-changes - name: commit-changes
taskRef: taskRef:
name: git-cli name: git-cli
@ -172,7 +174,7 @@ spec:
- name: GITEA_HOST_URL - name: GITEA_HOST_URL
value: code.fizz.buzz value: code.fizz.buzz
- name: SHA - name: SHA
value: "$(params.PULL_BASE_SHA)" value: "$(tasks.fetch-repository.results.commit)"
- name: DESCRIPTION - name: DESCRIPTION
value: "Build $(params.JOB_NAME) has succeeded" value: "Build $(params.JOB_NAME) has succeeded"
- name: STATE - name: STATE
@ -194,7 +196,7 @@ spec:
- name: GITEA_HOST_URL - name: GITEA_HOST_URL
value: code.fizz.buzz value: code.fizz.buzz
- name: SHA - name: SHA
value: "$(params.PULL_BASE_SHA)" value: "$(tasks.fetch-repository.results.commit)"
- name: DESCRIPTION - name: DESCRIPTION
value: "Build $(params.JOB_NAME) has failed" value: "Build $(params.JOB_NAME) has failed"
- name: STATE - name: STATE