From 908adeb4484603db0632153b93424711685c0d6b Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Tue, 20 Jun 2023 13:49:51 +0500 Subject: [PATCH 01/10] build: update github action for multi-arch docker images --- .github/workflows/docker-publish.yml | 34 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6bb8642993..b212cd010f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -16,16 +16,29 @@ jobs: # Use the release name as the image tag if we're building an open release tag. # Examples: if we're building 'open-release/olive.master', tag the image as 'olive.master'. # Otherwise, we must be building from a push to master, so use 'latest'. - - name: Get tag name - id: get-tag-name - uses: actions/github-script@v5 + # - name: Get tag name + # id: get-tag-name + # uses: actions/github-script@v5 + # with: + # script: | + # const branchName = context.ref.split('/').slice(-1)[0]; + # const tagName = branchName === 'master' ? 'latest' : branchName; + # console.log('Will use tag: ' + tagName); + # return tagName; + # result-encoding: string + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 with: - script: | - const branchName = context.ref.split('/').slice(-1)[0]; - const tagName = branchName === 'master' ? 'latest' : branchName; - console.log('Will use tag: ' + tagName); - return tagName; - result-encoding: string + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Build and push Dev Docker image uses: docker/build-push-action@v1 @@ -35,7 +48,8 @@ jobs: password: ${{ secrets.DOCKERHUB_PASSWORD }} target: dev repository: edxops/discovery-dev - tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} + # tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} + tags: edxops/discovery-dev:test # The current priority is to get the devstack off of Ansible based Images. Once that is done, we can come back to this part to get # suitable images for smaller prod environments. From ba3b5379b35e4785539a888ca32fef2ecfc04bf5 Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Tue, 20 Jun 2023 14:13:27 +0500 Subject: [PATCH 02/10] build: update github action for multi-arch docker images --- .github/workflows/docker-publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index b212cd010f..99db943767 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -44,12 +44,13 @@ jobs: uses: docker/build-push-action@v1 with: push: true - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_PASSWORD }} target: dev repository: edxops/discovery-dev # tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} tags: edxops/discovery-dev:test + platforms: linux/amd64,linux/arm64 # The current priority is to get the devstack off of Ansible based Images. Once that is done, we can come back to this part to get # suitable images for smaller prod environments. From 8483cd047cac45b99f5833ef9f9eb0afa59800e3 Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Tue, 11 Jul 2023 15:13:05 +0500 Subject: [PATCH 03/10] fix: test for docker multi-arch image push --- .github/workflows/docker-publish.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6bb8642993..6d87d63c81 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,6 +1,7 @@ name: Build and Push Docker Images on: + pull-request: push: branches: - master @@ -27,15 +28,29 @@ jobs: return tagName; result-encoding: string + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Build and push Dev Docker image - uses: docker/build-push-action@v1 + uses: docker/build-push-action@v4 with: push: true username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} target: dev repository: edxops/discovery-dev - tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} + # tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} + tags: edxops/discovery-dev-test + platforms: linux/amd64,linux/arm64 # The current priority is to get the devstack off of Ansible based Images. Once that is done, we can come back to this part to get # suitable images for smaller prod environments. From 5f175275c4c3e4cc2960177a862a42370a763c4d Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Tue, 11 Jul 2023 15:53:24 +0500 Subject: [PATCH 04/10] fix: test for docker multi-arch image push --- .github/workflows/docker-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 19cd48114d..5016b07d8d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -7,6 +7,7 @@ on: - master - open-release/** jobs: + pull-request: push: runs-on: ubuntu-latest From a3c270afd97a8e289a0d7e45325ad3c0886d3609 Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Tue, 11 Jul 2023 15:56:41 +0500 Subject: [PATCH 05/10] fix: test for docker multi-arch image push --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 5016b07d8d..f4248de2f0 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -7,7 +7,7 @@ on: - master - open-release/** jobs: - pull-request: + pull_request: push: runs-on: ubuntu-latest From db69d48d6ddfe518c737f91974a3a560b5798187 Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Tue, 11 Jul 2023 15:59:14 +0500 Subject: [PATCH 06/10] fix: test for docker multi-arch image push --- .github/workflows/docker-publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index f4248de2f0..c30e2e703b 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,13 +1,12 @@ name: Build and Push Docker Images on: - pull-request: + pull_request: push: branches: - master - open-release/** jobs: - pull_request: push: runs-on: ubuntu-latest From 444930c6354720d7f16acd124a9e93985c6a8064 Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Tue, 11 Jul 2023 16:13:20 +0500 Subject: [PATCH 07/10] fix: test for docker multi-arch image push --- .github/workflows/docker-publish.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index c30e2e703b..dd6b1df367 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -40,19 +40,6 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Build and push Dev Docker image uses: docker/build-push-action@v4 with: From 9f10be629157bba18b19fbd9693e0cdac79f9a84 Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Tue, 11 Jul 2023 16:28:44 +0500 Subject: [PATCH 08/10] fix: test for docker multi-arch image push --- .github/workflows/docker-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index dd6b1df367..8718efdbc6 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,6 +1,7 @@ name: Build and Push Docker Images on: + #adding this for testing, will remove this before merge pull_request: push: branches: From b2530318bd5354372cdf2318d968600dfc303a42 Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Thu, 13 Jul 2023 17:03:39 +0500 Subject: [PATCH 09/10] fix: docker multi-arch images --- .github/workflows/docker-publish.yml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 8718efdbc6..a5fc254ad1 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,8 +1,6 @@ name: Build and Push Docker Images on: - #adding this for testing, will remove this before merge - pull_request: push: branches: - master @@ -18,16 +16,16 @@ jobs: # Use the release name as the image tag if we're building an open release tag. # Examples: if we're building 'open-release/olive.master', tag the image as 'olive.master'. # Otherwise, we must be building from a push to master, so use 'latest'. - # - name: Get tag name - # id: get-tag-name - # uses: actions/github-script@v5 - # with: - # script: | - # const branchName = context.ref.split('/').slice(-1)[0]; - # const tagName = branchName === 'master' ? 'latest' : branchName; - # console.log('Will use tag: ' + tagName); - # return tagName; - # result-encoding: string + - name: Get tag name + id: get-tag-name + uses: actions/github-script@v5 + with: + script: | + const branchName = context.ref.split('/').slice(-1)[0]; + const tagName = branchName === 'master' ? 'latest' : branchName; + console.log('Will use tag: ' + tagName); + return tagName; + result-encoding: string - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -49,14 +47,13 @@ jobs: password: ${{ secrets.DOCKERHUB_PASSWORD }} target: dev repository: edxops/discovery-dev - # tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} - tags: edxops/discovery-dev:test + tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} platforms: linux/amd64,linux/arm64 # The current priority is to get the devstack off of Ansible based Images. Once that is done, we can come back to this part to get # suitable images for smaller prod environments. # - name: Build and push prod Docker image - # uses: docker/build-push-action@v1 + # uses: docker/build-push-action@v4 # with: # push: true # username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -64,3 +61,4 @@ jobs: # target: prod # repository: edxops/discovery-prod # tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} + # platforms: linux/amd64,linux/arm64 From 93115fe0b73ec94a1aaa54a4a9766441cfa70987 Mon Sep 17 00:00:00 2001 From: Salman Nawaz Date: Tue, 18 Jul 2023 15:43:17 +0500 Subject: [PATCH 10/10] fix: docker multi-arch images --- .github/workflows/docker-publish.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index a5fc254ad1..8441054b04 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -43,11 +43,11 @@ jobs: uses: docker/build-push-action@v4 with: push: true - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} target: dev repository: edxops/discovery-dev - tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} + tags: | + edxops/discovery-dev:${{ steps.get-tag-name.outputs.result }} + edxops/discovery-dev:${{ github.sha }} platforms: linux/amd64,linux/arm64 # The current priority is to get the devstack off of Ansible based Images. Once that is done, we can come back to this part to get @@ -56,9 +56,10 @@ jobs: # uses: docker/build-push-action@v4 # with: # push: true - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_PASSWORD }} # target: prod # repository: edxops/discovery-prod # tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} + # tags: | + # edxops/discovery-prod:${{ steps.get-tag-name.outputs.result }} + # edxops/discovery-prod:${{ github.sha }} # platforms: linux/amd64,linux/arm64