diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb7c99c..db25aa4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: jobs: check: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -34,16 +34,23 @@ jobs: if: failure() docker-build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - - name: Build docker image - uses: docker/build-push-action@v1 + # setup docker actions https://github.com/docker/build-push-action + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build image + id: docker_build + uses: docker/build-push-action@v2 with: - # login to repo - repository: wire/ci-test-image - # do not push image + # https://github.com/docker/build-push-action/issues/220 + context: . + tags: wire/ci-test-image push: false # Send webhook to Wire using Slack Bot diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml deleted file mode 100644 index f1c83bd..0000000 --- a/.github/workflows/master.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Docker Latest build - -on: - push: - branches: - - master - -env: - DOCKER_IMAGE: wire-bot/poll - -jobs: - publish: - name: Build and publish docker image - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set Release Version - # use latest tag as release version - run: echo ::set-env name=RELEASE_VERSION::${GITHUB_SHA} - - - name: Build docker image, push - uses: docker/build-push-action@v1 - with: - # set docker image - repository: ${{ env.DOCKER_IMAGE }} - # use GCR repository - registry: eu.gcr.io - # see https://github.com/marketplace/actions/docker-build-push#google-container-registry-gcr - username: _json_key - password: ${{ secrets.GCR_ACCESS_JSON }} - # pass release_version - build_args: release_version=${{ env.RELEASE_VERSION }} - # tag the image with name of the branch - latest as this is master - tag_with_ref: true - # add labels based on the build - see https://github.com/opencontainers/image-spec/blob/master/annotations.md - add_git_labels: true - # push - push: true - - # Send webhook to Wire using Slack Bot - - name: Webhook to Wire - uses: 8398a7/action-slack@v2 - with: - status: ${{ job.status }} - author_name: ${{ env.DOCKER_IMAGE }} master branch build - env: - SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_CI }} - # Send message only if previous step failed - if: failure() diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index fb443af..0ae4237 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -11,32 +11,44 @@ env: jobs: deploy: name: Build and deploy service - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Set Release Version # use latest tag as release version - run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF:10} + run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV - - name: Build and publish docker image - uses: docker/build-push-action@v1 + # extract metadata for labels https://github.com/crazy-max/ghaction-docker-meta + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: eu.gcr.io/${{ env.DOCKER_IMAGE }} + + # setup docker actions https://github.com/docker/build-push-action + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + # login to GCR repo + - name: Login to DockerHub + uses: docker/login-action@v1 with: - # set docker image - repository: ${{ env.DOCKER_IMAGE }} - # use GCR repository registry: eu.gcr.io - # see https://github.com/marketplace/actions/docker-build-push#google-container-registry-gcr username: _json_key password: ${{ secrets.GCR_ACCESS_JSON }} - # pass release_version - build_args: release_version=${{ env.RELEASE_VERSION }} - # tag the image with latest git tag - tag_with_ref: true - # add labels based on the build - see https://github.com/opencontainers/image-spec/blob/master/annotations.md - add_git_labels: true - # push only if this is tagged release + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + # push only if this is indeed a taged release push: ${{ startsWith(github.ref, 'refs/tags/') }} + build-args: | + release_version=${{ env.RELEASE_VERSION }} # Checkout our Kubernetes configuration - name: Checkout Rubicon @@ -66,13 +78,13 @@ jobs: rm "$SERVICE.yaml.bak" # Setup gcloud CLI - - name: Setup Google Cloud CLI - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@master with: - version: '286.0.0' service_account_email: kubernetes-deployment-agent@wire-bot.iam.gserviceaccount.com service_account_key: ${{ secrets.GKE_SA_KEY }} project_id: wire-bot + export_default_credentials: true # Configure Docker to use the gcloud command-line tool - name: Configure Docker Google cloud @@ -96,7 +108,7 @@ jobs: # Commit all data to Rubicon and open PR - name: Create Rubicon Pull Request - uses: peter-evans/create-pull-request@v2 + uses: peter-evans/create-pull-request@v3 with: path: rubicon branch: ${{ env.SERVICE_NAME }}-release diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 61f000b..0fc0924 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -12,41 +12,52 @@ env: jobs: publish: name: Deploy to staging - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + # use latest tag as release version in the docker container - name: Set Release Version - # use latest tag as release version - run: echo ::set-env name=RELEASE_VERSION::${GITHUB_SHA} + run: echo "RELEASE_VERSION=${GITHUB_SHA}" >> $GITHUB_ENV - - name: Build docker image, push - uses: docker/build-push-action@v1 + # extract metadata for labels https://github.com/crazy-max/ghaction-docker-meta + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: eu.gcr.io/${{ env.DOCKER_IMAGE }} + + # setup docker actions https://github.com/docker/build-push-action + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + # login to GCR repo + - name: Login to DockerHub + uses: docker/login-action@v1 with: - # set docker image - repository: ${{ env.DOCKER_IMAGE }} - # use GCR repository registry: eu.gcr.io - # see https://github.com/marketplace/actions/docker-build-push#google-container-registry-gcr username: _json_key password: ${{ secrets.GCR_ACCESS_JSON }} - # pass release_version - build_args: release_version=${{ env.RELEASE_VERSION }} - # tag the image with name of the branch - staging - tag_with_ref: true - # add labels based on the build - see https://github.com/opencontainers/image-spec/blob/master/annotations.md - add_git_labels: true - # push + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} push: true + build-args: | + release_version=${{ env.RELEASE_VERSION }} # Setup gcloud CLI - - name: Setup Google Cloud CLI - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@master with: - version: '286.0.0' service_account_email: kubernetes-deployment-agent@wire-bot.iam.gserviceaccount.com service_account_key: ${{ secrets.GKE_SA_KEY }} project_id: wire-bot + export_default_credentials: true # Configure Docker to use the gcloud command-line tool - name: Configure Docker Google cloud diff --git a/README.md b/README.md index 1d84ef4..4a1b22f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Wire Poll Bot [![GitHub version](https://badge.fury.io/gh/wireapp%2Fpoll-bot.svg)](https://badge.fury.io/gh/wireapp%2Fpoll-bot) ![CI](https://github.com/wireapp/poll-bot/workflows/CI/badge.svg) -![Test pipeline](https://github.com/wireapp/poll-bot/workflows/Test%20pipeline/badge.svg) ![Docker Latest build](https://github.com/wireapp/poll-bot/workflows/Docker%20Latest%20build/badge.svg) ![Staging Deployment](https://github.com/wireapp/poll-bot/workflows/Staging%20Deployment/badge.svg) ![Release Pipeline](https://github.com/wireapp/poll-bot/workflows/Release%20Pipeline/badge.svg) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6c9a224..4d9ca16 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists