From 209093b4f69cf5473568e3cfb070c87b9a799aa4 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 12 Jan 2024 12:25:00 +0100 Subject: [PATCH] action: honour the right parameters for notifying and fix condition (#374) (cherry picked from commit 08f08a8d06f62ee9149ac87510cec788144245ac) --- .buildkite/bump-golang.yml | 22 ++++++++++++++++------ .github/workflows/bump-golang-1.20.yml | 5 ----- .github/workflows/bump-golang.yml | 5 ----- .github/workflows/bump-golang/action.yml | 10 ++++++++++ 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.buildkite/bump-golang.yml b/.buildkite/bump-golang.yml index b9118f90..61e15705 100644 --- a/.buildkite/bump-golang.yml +++ b/.buildkite/bump-golang.yml @@ -63,15 +63,25 @@ conditions: image: golang tag: '{{ source "latestGoVersion" }}' sourceid: latestGoVersion - is: +## As long as there is a bug see https://github.com/updatecli/updatecli/issues/1849 +## Let's use the shell kind rather than the file kind. +## When fixed then uncomment the code and remove is-already-updated +# is: +# name: Is version '{{ source "latestGoVersion" }}' not updated in 'go/Makefile.common'? +# disablesourceinput: true +# kind: file +# spec: +# file: go/Makefile.common +# line: 5 +# content: VERSION := {{ source `latestGoVersion` }} +# failwhen: true + is-already-updated: name: Is version '{{ source "latestGoVersion" }}' not updated in 'go/Makefile.common'? disablesourceinput: true - kind: file + kind: shell spec: - file: go/Makefile.common - line: 5 - content: VERSION := {{ source `latestGoVersion` }} - failwhen: true + command: grep 'VERSION := {{ source `latestGoVersion` }}' go/Makefile.common && exit 1 || exit 0 + failwhen: false targets: update-go-version: diff --git a/.github/workflows/bump-golang-1.20.yml b/.github/workflows/bump-golang-1.20.yml index d816acf9..5e6af47f 100644 --- a/.github/workflows/bump-golang-1.20.yml +++ b/.github/workflows/bump-golang-1.20.yml @@ -9,9 +9,6 @@ on: permissions: contents: read -env: - JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - jobs: bump: runs-on: ubuntu-latest @@ -24,5 +21,3 @@ jobs: vaultUrl: ${{ secrets.VAULT_ADDR }} vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} - notifySlackChannel: "#ingest-notifications" - messageIfFailure: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @agent-team please look what's going on <${{ env.JOB_URL }}|here>" diff --git a/.github/workflows/bump-golang.yml b/.github/workflows/bump-golang.yml index ce38406d..79a93dc1 100644 --- a/.github/workflows/bump-golang.yml +++ b/.github/workflows/bump-golang.yml @@ -9,9 +9,6 @@ on: permissions: contents: read -env: - JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - jobs: bump: runs-on: ubuntu-latest @@ -24,5 +21,3 @@ jobs: vaultUrl: ${{ secrets.VAULT_ADDR }} vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} - notifySlackChannel: "#ingest-notifications" - messageIfFailure: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @agent-team please look what's going on <${{ env.JOB_URL }}|here>" diff --git a/.github/workflows/bump-golang/action.yml b/.github/workflows/bump-golang/action.yml index 88448764..70cf73c0 100644 --- a/.github/workflows/bump-golang/action.yml +++ b/.github/workflows/bump-golang/action.yml @@ -7,6 +7,14 @@ inputs: go-minor: description: 'What Go minor version ([0-9]+.[0.9]+)' required: true + messageIfFailure: + description: 'Vault secret ID' + required: false + default: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @agent-team please look what's going on <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>" + notifySlackChannel: + description: 'Vault secret ID' + required: false + default: "#ingest-notifications" vaultUrl: description: 'Vault URL' required: true @@ -30,6 +38,8 @@ runs: vaultRoleId: ${{ inputs.vaultRoleId }} vaultSecretId: ${{ inputs.vaultSecretId }} pipeline: ./.buildkite/bump-golang.yml + notifySlackChannel: ${{ inputs.notifySlackChannel }} + messageIfFailure: ${{ inputs.messageIfFailure }} env: BRANCH: ${{ inputs.branch }} GO_MINOR: ${{ inputs.go-minor }}