From 18fd9d40bd4d14427bcb4d77be7c103bd678b737 Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Wed, 4 Aug 2021 21:38:45 +0200 Subject: [PATCH 1/4] Attempt to fixing docker build (dockerhub-initiated builds seem to have gone paid-only) --- .github/workflows/tests.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a43a3b8a0d..cdd2f0e9fd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,7 +44,7 @@ jobs: - run: tox -e ${{ matrix.tox }} verify_docker_build: - name: Verify Docker image build + name: Verify docker, push if on master needs: tests runs-on: ubuntu-latest steps: @@ -53,8 +53,22 @@ jobs: with: context: ./ file: ./Dockerfile - push: false - tags: locustio/locust:latest + push: ${{ github.ref == 'refs/heads/master' }} + tags: locustio/locust:master + + docker_tagged: + name: Push to version-specific tag, also push latest if on master + needs: tests + runs-on: ubuntu-latest + if: startsWith(github.event.ref, 'refs/tags') + steps: + - uses: actions/checkout@v2 + - uses: docker/build-push-action@v2 + with: + context: ./ + file: ./Dockerfile + push: true + tags: locustio/locust:${{ github.event.release.tag_name }}${{ (github.ref == 'refs/heads/master' && ',locustio/locust:latest') || '' }} release: name: Release to PyPI @@ -80,3 +94,10 @@ jobs: with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} + - name: Push to docker + uses: docker/build-push-action@v2 + with: + context: ./ + file: ./Dockerfile + push: true + tags: locustio/locust:${{ github.event.release.tag_name }} # tags the image based on git tag name instead of package version, but that should be good enough. From 9f113be8d65aae7be255d08752d2614a30fa025c Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Wed, 4 Aug 2021 22:06:37 +0200 Subject: [PATCH 2/4] Docker build: Try different way to get git tag --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cdd2f0e9fd..9f898bec6a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -68,8 +68,8 @@ jobs: context: ./ file: ./Dockerfile push: true - tags: locustio/locust:${{ github.event.release.tag_name }}${{ (github.ref == 'refs/heads/master' && ',locustio/locust:latest') || '' }} - + tags: locustio/locust:${GITHUB_REF#refs/*/}${{ (github.ref == 'refs/heads/master' && ',locustio/locust:latest') || '' }} + release: name: Release to PyPI needs: verify_docker_build From 208ec49ebc9cef81319d7c603c1ebe3f0e5db305 Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Wed, 4 Aug 2021 22:32:24 +0200 Subject: [PATCH 3/4] GH actions: Do we need to use an a whole new plugin to get the git tag? --- .github/workflows/tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9f898bec6a..d3ac5bc417 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -63,12 +63,15 @@ jobs: if: startsWith(github.event.ref, 'refs/tags') steps: - uses: actions/checkout@v2 + - name: Get git tag + id: tag + uses: dawidd6/action-get-tag@v1 - uses: docker/build-push-action@v2 with: context: ./ file: ./Dockerfile push: true - tags: locustio/locust:${GITHUB_REF#refs/*/}${{ (github.ref == 'refs/heads/master' && ',locustio/locust:latest') || '' }} + tags: locustio/locust:${{ steps.tag.outputs.tag }}${{ (github.ref == 'refs/heads/master' && ',locustio/locust:latest') || '' }} release: name: Release to PyPI From 8066f28e0854021933f2701e5b5fad3fc6299aea Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Sun, 8 Aug 2021 12:38:46 +0200 Subject: [PATCH 4/4] Docker builds: use locustbuild account with secret docker hub access token. --- .github/workflows/tests.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d3ac5bc417..18532d3c70 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,6 +49,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: locustbuild + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - uses: docker/build-push-action@v2 with: context: ./ @@ -66,6 +71,11 @@ jobs: - name: Get git tag id: tag uses: dawidd6/action-get-tag@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: locustbuild + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - uses: docker/build-push-action@v2 with: context: ./