Add exponential backoff for Slack requests #198
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- run: go mod download | |
- run: go test -cpu=1,2 -race ./... | |
image: | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/metadata-action@v5 | |
id: docker_meta | |
with: | |
images: docker.io/arbourd/concourse-slack-alert-resource,ghcr.io/arbourd/concourse-slack-alert-resource | |
tags: | | |
type=edge | |
type=semver,pattern={{raw}} | |
flavor: | | |
latest=auto | |
- name: Build test image | |
uses: docker/build-push-action@v6 | |
with: | |
cache-from: type=gha | |
load: true | |
push: false | |
tags: concourse-slack-alert-resource:dev | |
- run: > | |
echo "{\"source\":{\"url\":\"${{ vars.SLACK_WEBHOOK }}\"}}" | docker run -i | |
-e "BUILD_TEAM_NAME=main" | |
-e "BUILD_PIPELINE_NAME=github-actions" | |
-e "BUILD_JOB_NAME=test" | |
-e "BUILD_NAME=$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER" | |
-e "BUILD_PIPELINE_INSTANCE_VARS={\"ref\":\"$GITHUB_REF_NAME\"}" | |
concourse-slack-alert-resource:dev | |
/opt/resource/out $PWD | |
- if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' | |
uses: docker/login-action@v3 | |
with: | |
registry: docker.io | |
username: arbourd | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and publish image | |
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' | |
uses: docker/build-push-action@v6 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} |