From 4855d3b4f05ce5b25bd5d27bdea6115c6cddcd87 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 14 Jul 2023 00:45:13 -0400 Subject: [PATCH] Switch to using the commit hash from the fetch-repository step for gitea status. 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. --- .lighthouse/pipeline-rust-test.yaml | 12 +++++++----- .lighthouse/pipeline-rustfmt.yaml | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.lighthouse/pipeline-rust-test.yaml b/.lighthouse/pipeline-rust-test.yaml index 9a9582f2..f456da27 100644 --- a/.lighthouse/pipeline-rust-test.yaml +++ b/.lighthouse/pipeline-rust-test.yaml @@ -43,6 +43,8 @@ spec: - name: report-pending taskRef: name: gitea-set-status + runAfter: + - fetch-repository params: - name: CONTEXT value: "$(params.JOB_NAME)" @@ -51,7 +53,7 @@ spec: - name: GITEA_HOST_URL value: code.fizz.buzz - name: SHA - value: "$(params.PULL_BASE_SHA)" + value: "$(tasks.fetch-repository.results.commit)" - name: DESCRIPTION value: "Build $(params.JOB_NAME) has started" - name: STATE @@ -76,7 +78,7 @@ spec: name: kaniko params: - name: IMAGE - value: "$(params.image-name):$(params.PULL_BASE_SHA)" + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - name: CONTEXT value: $(params.path-to-image-context) - name: DOCKERFILE @@ -116,7 +118,7 @@ spec: - name: args value: ["$(params.args[*])"] - name: docker-image - value: "$(params.image-name):$(params.PULL_BASE_SHA)" + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" finally: - name: report-success when: @@ -133,7 +135,7 @@ spec: - name: GITEA_HOST_URL value: code.fizz.buzz - name: SHA - value: "$(params.PULL_BASE_SHA)" + value: "$(tasks.fetch-repository.results.commit)" - name: DESCRIPTION value: "Build $(params.JOB_NAME) has succeeded" - name: STATE @@ -155,7 +157,7 @@ spec: - name: GITEA_HOST_URL value: code.fizz.buzz - name: SHA - value: "$(params.PULL_BASE_SHA)" + value: "$(tasks.fetch-repository.results.commit)" - name: DESCRIPTION value: "Build $(params.JOB_NAME) has failed" - name: STATE diff --git a/.lighthouse/pipeline-rustfmt.yaml b/.lighthouse/pipeline-rustfmt.yaml index 5cf736a5..4b506f94 100644 --- a/.lighthouse/pipeline-rustfmt.yaml +++ b/.lighthouse/pipeline-rustfmt.yaml @@ -51,6 +51,8 @@ spec: - name: report-pending taskRef: name: gitea-set-status + runAfter: + - fetch-repository params: - name: CONTEXT value: "$(params.JOB_NAME)" @@ -59,7 +61,7 @@ spec: - name: GITEA_HOST_URL value: code.fizz.buzz - name: SHA - value: "$(params.PULL_BASE_SHA)" + value: "$(tasks.fetch-repository.results.commit)" - name: DESCRIPTION value: "Build $(params.JOB_NAME) has started" - name: STATE @@ -92,7 +94,7 @@ spec: name: kaniko params: - name: IMAGE - value: "$(params.image-name):$(params.PULL_BASE_SHA)" + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - name: CONTEXT value: $(params.path-to-image-context) - name: DOCKERFILE @@ -131,7 +133,7 @@ spec: - name: args value: ["$(params.args[*])"] - name: docker-image - value: "$(params.image-name):$(params.PULL_BASE_SHA)" + value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" - name: commit-changes taskRef: name: git-cli @@ -172,7 +174,7 @@ spec: - name: GITEA_HOST_URL value: code.fizz.buzz - name: SHA - value: "$(params.PULL_BASE_SHA)" + value: "$(tasks.fetch-repository.results.commit)" - name: DESCRIPTION value: "Build $(params.JOB_NAME) has succeeded" - name: STATE @@ -194,7 +196,7 @@ spec: - name: GITEA_HOST_URL value: code.fizz.buzz - name: SHA - value: "$(params.PULL_BASE_SHA)" + value: "$(tasks.fetch-repository.results.commit)" - name: DESCRIPTION value: "Build $(params.JOB_NAME) has failed" - name: STATE