From 7fbe03ae37f6f56bfc018291185f85b86b62a683 Mon Sep 17 00:00:00 2001 From: Keepers Date: Mon, 3 Jul 2023 16:59:43 -0600 Subject: [PATCH] remove goreleaser replacements property (#3747) Goreleaser [deprecated](https://goreleaser.com/deprecations/?h=replacement#archivesreplacements) the replacements yaml property, which has been causing our binary publications to fail for a while now. This fixes the yaml and introduces a slack message for binary publication failures. --- .github/actions/publish-binary/action.yml | 35 +++++++++++++++++++++++ .github/workflows/binary-publish.yml | 3 +- .github/workflows/ci.yml | 1 + src/.goreleaser.yaml | 16 ++++++----- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/.github/actions/publish-binary/action.yml b/.github/actions/publish-binary/action.yml index 2a8215592..2148a2ce5 100644 --- a/.github/actions/publish-binary/action.yml +++ b/.github/actions/publish-binary/action.yml @@ -13,6 +13,9 @@ inputs: rudderstack_data_plane_url: description: Data plane URL for RudderStack required: true + slack_webhook_url: + description: Slack webhook url + required: true runs: using: composite @@ -73,3 +76,35 @@ runs: with: name: corso_Windows_amd64 path: src/dist/corso_windows_amd64_v1/corso.exe + + - name: SHA info + shell: bash + id: sha-info + if: failure() + run: | + echo ${GITHUB_REF#refs/heads/}-${GITHUB_SHA} + echo SHA=${GITHUB_REF#refs/heads/}-${GITHUB_SHA} >> $GITHUB_OUTPUT + echo RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_OUTPUT + echo COMMIT_URL=${{ github.server_url }}/${{ github.repository }}/commit/${GITHUB_SHA} >> $GITHUB_OUTPUT + + - name: Send Github Action failure to Slack + id: slack-notification + if: failure() + uses: slackapi/slack-github-action@v1.24.0 + with: + payload: | + { + "text": "Publish failure - build: ${{ job.status }} - SHA: ${{ steps.sha-info.outputs.SHA }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "[FAILED] Publishing Binary :: <${{ steps.sha-info.outputs.RUN_URL }}|[Logs]> <${{ steps.sha-info.outputs.COMMIT_URL }}|[Base]>\nCommit: <${{ steps.sha-info.outputs.COMMIT_URL }}|${{ steps.sha-info.outputs.SHA }}>" + } + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ inputs.slack_webhook_url }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK diff --git a/.github/workflows/binary-publish.yml b/.github/workflows/binary-publish.yml index f2ba78438..27cb7449c 100644 --- a/.github/workflows/binary-publish.yml +++ b/.github/workflows/binary-publish.yml @@ -34,4 +34,5 @@ jobs: version: ${{ needs.SetEnv.outputs.version }} github_token: ${{ secrets.GITHUB_TOKEN }} rudderstack_write_key: ${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }} - rudderstack_data_plane_url: ${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }} \ No newline at end of file + rudderstack_data_plane_url: ${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }} + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 282f6a84b..8d128b208 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -454,6 +454,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} rudderstack_write_key: ${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }} rudderstack_data_plane_url: ${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }} + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} Publish-Image: needs: [Test-Suite-Trusted, Source-Code-Linting, Website-Linting, SetEnv] diff --git a/src/.goreleaser.yaml b/src/.goreleaser.yaml index c6045222e..4c87c89e3 100644 --- a/src/.goreleaser.yaml +++ b/src/.goreleaser.yaml @@ -18,13 +18,15 @@ builds: - -X 'github.com/alcionai/corso/src/internal/events.RudderStackDataPlaneURL={{.Env.RUDDERSTACK_CORSO_DATA_PLANE_URL}}' archives: - - name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}" - replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: i386 - amd64: x86_64 + # this name template makes the OS and Arch compatible with the results of uname. + - name_template: >- + {{ .ProjectName }}_ + {{- .Tag }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} format: tar.gz format_overrides: - goos: windows