From 563996a7b025b32dfa08ded17c4e80864189f111 Mon Sep 17 00:00:00 2001 From: Aitor Perez Cedres <1515757+Zerpet@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:17:18 +0100 Subject: [PATCH] [CI] Update workflows - Use supported method to generate step output - Add missing permission for Upload GCS job - Use go.mod to determine Go version to install - Use floating major tag - Switch to GChat notification --- .github/workflows/build-test-publish.yml | 3 ++ .github/workflows/prometheus-rules.yml | 11 +++--- .../workflows/publish-versioned-api-ref.yml | 18 +++++---- .github/workflows/release.yml | 3 +- .github/workflows/stale.yml | 2 +- .github/workflows/update-latest-api-ref.yml | 37 ------------------- 6 files changed, 23 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/update-latest-api-ref.yml diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index d86592160..9d63874dd 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -220,6 +220,9 @@ jobs: if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }} needs: - build_operator + permissions: + contents: 'read' + id-token: 'write' env: image_version: ${{ needs.build_operator.outputs.image_tag }} steps: diff --git a/.github/workflows/prometheus-rules.yml b/.github/workflows/prometheus-rules.yml index 23561eef1..9a91ab2cc 100644 --- a/.github/workflows/prometheus-rules.yml +++ b/.github/workflows/prometheus-rules.yml @@ -6,18 +6,18 @@ on: paths: - observability/prometheus/rules/**/*.y*ml -env: - GO_VERSION: ~1.21 - jobs: rules: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + name: Checkout code + - name: Install Go uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/checkout@v4 + go-version-file: "go.mod" + - name: Create Prometheus rule file run: | make install-tools @@ -35,6 +35,7 @@ jobs: append_rabbitmq_rules='select(fileIndex==0).groups.[1].rules = select(fileIndex==0).groups.[1].rules + select(fileIndex==1).spec.groups.[0].rules | select(fileIndex==0)' find rules/rabbitmq -name "*.y*ml" ! -name recording-rules.yml -exec yq eval-all --inplace --no-colors --prettyPrint "$append_rabbitmq_rules" rule-file.yml {} ';' yq eval-all --inplace --no-colors --prettyPrint "$append_rabbitmq_rules" rule-file.yml rules/rabbitmq/recording-rules.yml + - name: Check Prometheus rule file run: | # need to use @main because of https://github.com/prometheus/prometheus/issues/8586#issuecomment-796976710 diff --git a/.github/workflows/publish-versioned-api-ref.yml b/.github/workflows/publish-versioned-api-ref.yml index 9fa28d958..17cd01442 100644 --- a/.github/workflows/publish-versioned-api-ref.yml +++ b/.github/workflows/publish-versioned-api-ref.yml @@ -15,14 +15,17 @@ jobs: uses: actions/checkout@v4 with: path: cluster-operator + - name: Get the version id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + run: echo VERSION=${GITHUB_REF#refs/tags/} >> "$GITHUB_OUTPUT" + - name: Checkout wiki codebase uses: actions/checkout@v4 with: repository: ${{ github.repository }}.wiki path: wiki + - name: Push to wiki run: | cd wiki @@ -36,10 +39,11 @@ jobs: git add ./API_Reference_${{ steps.get_version.outputs.VERSION }}.asciidoc git add ./Wiki_Sidebar.md git commit -m "Publish version ${{ steps.get_version.outputs.VERSION }} API Reference" && git push - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,action,eventName - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + + - name: Notify Google Chat if: failure() + uses: SimonScholz/google-chat-action@main + with: + webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}' + jobStatus: ${{ job.status }} + title: Cluster Operator - ${{ github.workflow }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f952fde46..19c80cf69 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@main + uses: actions/checkout@v4 + - name: Update new version in krew-index uses: rajatjindal/krew-release-bot@v0.0.46 with: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index ff3a61224..73fb9f5a1 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Close Stale Issues - uses: actions/stale@v9.0.0 + uses: actions/stale@v9 with: # Token for the repository. Can be passed in using `{{ secrets.GITHUB_TOKEN }}`. repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-latest-api-ref.yml b/.github/workflows/update-latest-api-ref.yml deleted file mode 100644 index 5f1fca99d..000000000 --- a/.github/workflows/update-latest-api-ref.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: "Update Latest API Reference Wiki page" - -on: - push: - branches: [ main ] - -jobs: - update-api-reference: - name: Update Latest API Reference Wiki - runs-on: ubuntu-latest - - steps: - - name: Checkout operator codebase - uses: actions/checkout@v4 - with: - path: cluster-operator - - name: Checkout wiki codebase - uses: actions/checkout@v4 - with: - repository: ${{ github.repository }}.wiki - path: wiki - - name: Push to wiki - run: | - cd wiki - git config --local user.email "github-actions@github.com" - git config --local user.name "github-actions" - # Update the latest API Reference Doc - cp ../cluster-operator/docs/api/rabbitmq.com.ref.asciidoc ./API_Reference.asciidoc - git add ./API_Reference.asciidoc - git diff-index --quiet HEAD || git commit -m "Update Latest API Reference" && git push - - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,action,eventName - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: failure()