From db7516f98e8cbd3d0f48e5013ccc308d9b3fb195 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 16:43:41 +0800 Subject: [PATCH 01/15] spoort multiarch release Signed-off-by: Jared Tan --- .github/workflows/release.yml | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c26d2719fa..91f9749b6a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,8 +3,44 @@ name: "Release" on: release: types: [published] + pull_request: + branches: [ main ] # for debug, pls remove this jobs: + docker_build_matrix: + strategy: + matrix: + file_tag: + - file: ./src/adservice/Dockerfile + tag: adservice + - file: ./src/cartservice/src/Dockerfile + tag: cartservice + - file: ./src/checkoutservice/Dockerfile + tag: checkoutservice + - file: ./src/currencyservice/Dockerfile + tag: currencyservice + - file: ./src/emailservice/Dockerfile + tag: emailservice + - file: ./src/frontend/Dockerfile + tag: frontend + - file: ./src/paymentservice/Dockerfile + tag: paymentservice + - file: ./src/productcatalogservice/Dockerfile + tag: productcatalogservice + - file: ./src/quoteservice/Dockerfile + tag: quoteservice + - file: ./src/shippingservice/Dockerfile + tag: shippingservice + - file: ./src/featureflagservice/Dockerfile + tag: featureflagservice + - file: ./src/loadgenerator/Dockerfile + tag: loadgenerator + - file: ./src/recommendationservice/Dockerfile + tag: recommendationservice + - file: ./src/frontend/Dockerfile.cypress + tag: frontend-tests + - file: ./test/Dockerfile + tag: integrationTests build_and_push_images: runs-on: ubuntu-latest permissions: @@ -28,6 +64,20 @@ jobs: echo $'{"max-concurrent-uploads": 1}' | sudo dd status=none of=/etc/docker/daemon.json sudo service docker restart + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.0.0 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -41,6 +91,18 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Matrix Build and push demo images + uses: docker/build-push-action@v3.1.1 + with: + context: ./ + file: ${{ matrix.file_tag.file }} + platforms: linux/amd64,linux/arm64 + #push: ${{ github.event_name != 'pull_request' }} + push: true + tags: ${{ env.DOCKERHUB_REPO }}:${{ env.RELEASE_VERSION }},${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION }}, + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + - name: prepare build env run: make build-env-file From 196c21f078cc4dd76ed490a870b8f386b7d7b9c5 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 17:08:01 +0800 Subject: [PATCH 02/15] update Signed-off-by: Jared Tan --- .github/workflows/release.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b34ba68fe1..acaba67bd8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -113,12 +113,3 @@ jobs: tags: ${{ env.DOCKERHUB_REPO }}:${{ env.RELEASE_VERSION }},${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION }}, cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache - - - name: prepare build env - run: make build-env-file - - - name: build and push ghcr docker image - run: make build-and-push-ghcr - - - name: build and push dockerhub image - run: make build-and-push-dockerhub From 7afc798423870ac5ee105976d266aa891d5c8b00 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 17:09:54 +0800 Subject: [PATCH 03/15] debug Signed-off-by: Jared Tan --- .github/workflows/release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index acaba67bd8..c36c90b6c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,6 @@ name: "Release" on: - release: - types: [published] pull_request: branches: [ main ] # for debug, pls remove this From 31dba390f9ab62568a2a0af9cc071f608d10c4c5 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 17:44:37 +0800 Subject: [PATCH 04/15] update Signed-off-by: Jared Tan --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c36c90b6c3..6ac7ccaa24 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,9 @@ name: "Release" on: + # for debug, pls remove this pull_request: - branches: [ main ] # for debug, pls remove this + branches: [ main ] jobs: docker_build_matrix: From 55a1afe445eeb7e52218fff1ce1d4cdd10fb0b23 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 17:46:27 +0800 Subject: [PATCH 05/15] remove tag Signed-off-by: Jared Tan --- .github/workflows/release.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6ac7ccaa24..4941bc1690 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,35 +11,20 @@ jobs: matrix: file_tag: - file: ./src/adservice/Dockerfile - tag: adservice - file: ./src/cartservice/src/Dockerfile - tag: cartservice - file: ./src/checkoutservice/Dockerfile - tag: checkoutservice - file: ./src/currencyservice/Dockerfile - tag: currencyservice - file: ./src/emailservice/Dockerfile - tag: emailservice - file: ./src/frontend/Dockerfile - tag: frontend - file: ./src/paymentservice/Dockerfile - tag: paymentservice - file: ./src/productcatalogservice/Dockerfile - tag: productcatalogservice - file: ./src/quoteservice/Dockerfile - tag: quoteservice - file: ./src/shippingservice/Dockerfile - tag: shippingservice - file: ./src/featureflagservice/Dockerfile - tag: featureflagservice - file: ./src/loadgenerator/Dockerfile - tag: loadgenerator - file: ./src/recommendationservice/Dockerfile - tag: recommendationservice - file: ./src/frontend/Dockerfile.cypress - tag: frontend-tests - file: ./test/Dockerfile - tag: integrationTests build_and_push_images: runs-on: ubuntu-latest permissions: From 94ab1881604af66599ba086a84ae04df72839a18 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 17:53:08 +0800 Subject: [PATCH 06/15] update Signed-off-by: Jared Tan --- .github/workflows/release.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4941bc1690..e3732a1d71 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,17 @@ on: branches: [ main ] jobs: - docker_build_matrix: + build_and_push_images: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + env: + RELEASE_VERSION: "${{ github.event.release.tag_name }}" + DOCKERHUB_REPO: "otel/demo" + GHCR_REPO: "ghcr.io/open-telemetry/demo" + strategy: matrix: file_tag: @@ -25,17 +35,6 @@ jobs: - file: ./src/recommendationservice/Dockerfile - file: ./src/frontend/Dockerfile.cypress - file: ./test/Dockerfile - build_and_push_images: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - env: - RELEASE_VERSION: "${{ github.event.release.tag_name }}" - DOCKERHUB_REPO: "otel/demo" - GHCR_REPO: "ghcr.io/open-telemetry/demo" - steps: - uses: actions/checkout@v3 with: From f83187714b4e37e8c927a0f46e7d0bb36c581dab Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 17:56:34 +0800 Subject: [PATCH 07/15] remove update env file Signed-off-by: Jared Tan --- .github/workflows/release.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3732a1d71..2c0f016823 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,16 +40,16 @@ jobs: with: fetch-depth: 0 - - name: Update .env - run: sed -i "s/IMAGE_VERSION=.*/IMAGE_VERSION=${RELEASE_VERSION}/" .env + # - name: Update .env + # run: sed -i "s/IMAGE_VERSION=.*/IMAGE_VERSION=${RELEASE_VERSION}/" .env - - name: Commit updated .env file - uses: test-room-7/action-update-file@v1 - with: - file: .env - commit-message: "Update .env file with release version" - branch: main - github-token: ${{ secrets.GITHUB_TOKEN }} + # - name: Commit updated .env file + # uses: test-room-7/action-update-file@v1 + # with: + # file: .env + # commit-message: "Update .env file with release version" + # branch: main + # github-token: ${{ secrets.GITHUB_TOKEN }} # limit docker push image concurrency to 1 # to avoid github package return 429 ratelimit error From d980443cb08c04dd106b80102515ea4321727fa5 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 17:57:58 +0800 Subject: [PATCH 08/15] note login Signed-off-by: Jared Tan --- .github/workflows/release.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c0f016823..c71c39797e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,18 +72,18 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + # - name: Log in to the Container registry + # uses: docker/login-action@v2 + # with: + # registry: ghcr.io + # username: ${{ github.repository_owner }} + # password: ${{ secrets.GITHUB_TOKEN }} - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + # - name: Log in to Docker Hub + # uses: docker/login-action@v2 + # with: + # username: ${{ secrets.DOCKER_USERNAME }} + # password: ${{ secrets.DOCKER_PASSWORD }} - name: Matrix Build and push demo images uses: docker/build-push-action@v3.1.1 From 16ad85def6c858e2bb5f8d7f769dc9cc1fc54b40 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 17:59:22 +0800 Subject: [PATCH 09/15] debug Signed-off-by: Jared Tan --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c71c39797e..89cbb69012 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,8 @@ jobs: packages: write env: - RELEASE_VERSION: "${{ github.event.release.tag_name }}" + #RELEASE_VERSION: "${{ github.event.release.tag_name }}" + RELEASE_VERSION: "test" DOCKERHUB_REPO: "otel/demo" GHCR_REPO: "ghcr.io/open-telemetry/demo" From 0483442d91d29e53232cf0dfa6ffd1aa43725924 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 18:32:39 +0800 Subject: [PATCH 10/15] finish Signed-off-by: Jared Tan --- .github/workflows/release.yml | 41 +++++++++++++++-------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 89cbb69012..3d486b5694 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,9 @@ name: "Release" on: - # for debug, pls remove this + # release: + # types: [published] + # for debug, remember remove this pull_request: branches: [ main ] @@ -13,8 +15,9 @@ jobs: packages: write env: + # for debug, remember remove this #RELEASE_VERSION: "${{ github.event.release.tag_name }}" - RELEASE_VERSION: "test" + RELEASE_VERSION: "dev" DOCKERHUB_REPO: "otel/demo" GHCR_REPO: "ghcr.io/open-telemetry/demo" @@ -41,17 +44,6 @@ jobs: with: fetch-depth: 0 - # - name: Update .env - # run: sed -i "s/IMAGE_VERSION=.*/IMAGE_VERSION=${RELEASE_VERSION}/" .env - - # - name: Commit updated .env file - # uses: test-room-7/action-update-file@v1 - # with: - # file: .env - # commit-message: "Update .env file with release version" - # branch: main - # github-token: ${{ secrets.GITHUB_TOKEN }} - # limit docker push image concurrency to 1 # to avoid github package return 429 ratelimit error - name: Set docker upload concurrent @@ -73,18 +65,18 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- - # - name: Log in to the Container registry - # uses: docker/login-action@v2 - # with: - # registry: ghcr.io - # username: ${{ github.repository_owner }} - # password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - # - name: Log in to Docker Hub - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKER_USERNAME }} - # password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Matrix Build and push demo images uses: docker/build-push-action@v3.1.1 @@ -92,6 +84,7 @@ jobs: context: ./ file: ${{ matrix.file_tag.file }} platforms: linux/amd64,linux/arm64 + # for debug, remember remove this #push: ${{ github.event_name != 'pull_request' }} push: true tags: ${{ env.DOCKERHUB_REPO }}:${{ env.RELEASE_VERSION }},${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION }}, From 1e54a7bbf6cadaa8090d174e73ceb58c8044d9d7 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 18:35:50 +0800 Subject: [PATCH 11/15] update changelog Signed-off-by: Jared Tan --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4b8e563f4..eb53a6d16c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -124,3 +124,5 @@ significant modifications will be credited to OpenTelemetry Authors. ([#455](https://github.com/open-telemetry/opentelemetry-demo/pull/455)) * Update cartservice Dockerfile to support ARM64 ([#439](https://github.com/open-telemetry/opentelemetry-demo/pull/439)) +* Build multi-arch/platform images as part of release +([#488](https://github.com/open-telemetry/opentelemetry-demo/pull/488)) From 412331202e7ee0028ff31fc1d725a9fcd05b7295 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 18:37:06 +0800 Subject: [PATCH 12/15] update Signed-off-by: Jared Tan --- .github/workflows/release.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d486b5694..3c2db40c75 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,8 @@ name: "Release" on: - # release: - # types: [published] - # for debug, remember remove this - pull_request: - branches: [ main ] + release: + types: [published] jobs: build_and_push_images: @@ -15,9 +12,7 @@ jobs: packages: write env: - # for debug, remember remove this - #RELEASE_VERSION: "${{ github.event.release.tag_name }}" - RELEASE_VERSION: "dev" + RELEASE_VERSION: "${{ github.event.release.tag_name }}" DOCKERHUB_REPO: "otel/demo" GHCR_REPO: "ghcr.io/open-telemetry/demo" @@ -84,9 +79,7 @@ jobs: context: ./ file: ${{ matrix.file_tag.file }} platforms: linux/amd64,linux/arm64 - # for debug, remember remove this - #push: ${{ github.event_name != 'pull_request' }} - push: true + push: ${{ github.event_name != 'pull_request' }} tags: ${{ env.DOCKERHUB_REPO }}:${{ env.RELEASE_VERSION }},${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION }}, cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache From 3688b6442f732640b8650296ca84ec20715367af Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 18:43:19 +0800 Subject: [PATCH 13/15] polish Signed-off-by: Jared Tan --- .github/workflows/release.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c2db40c75..160028ede3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,20 +20,35 @@ jobs: matrix: file_tag: - file: ./src/adservice/Dockerfile + tag_suffix: adservice - file: ./src/cartservice/src/Dockerfile + tag_suffix: cartservice - file: ./src/checkoutservice/Dockerfile + tag_suffix: checkoutservice - file: ./src/currencyservice/Dockerfile + tag_suffix: currencyservice - file: ./src/emailservice/Dockerfile + tag_suffix: emailservice - file: ./src/frontend/Dockerfile + tag_suffix: frontend - file: ./src/paymentservice/Dockerfile + tag_suffix: paymentservice - file: ./src/productcatalogservice/Dockerfile + tag_suffix: productcatalogservice - file: ./src/quoteservice/Dockerfile + tag_suffix: quoteservice - file: ./src/shippingservice/Dockerfile + tag_suffix: shippingservice - file: ./src/featureflagservice/Dockerfile + tag_suffix: featureflagservice - file: ./src/loadgenerator/Dockerfile + tag_suffix: loadgenerator - file: ./src/recommendationservice/Dockerfile + tag_suffix: recommendationservice - file: ./src/frontend/Dockerfile.cypress + tag_suffix; frontend-tests - file: ./test/Dockerfile + tag_suffix: integrationTests steps: - uses: actions/checkout@v3 with: @@ -80,6 +95,6 @@ jobs: file: ${{ matrix.file_tag.file }} platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} - tags: ${{ env.DOCKERHUB_REPO }}:${{ env.RELEASE_VERSION }},${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION }}, + tags: ${{ env.DOCKERHUB_REPO }}:${{ env.RELEASE_VERSION }}-${{ matrix.file_tag.tag_suffix }},${{ env.GHCR_REPO }}:${{ env.RELEASE_VERSION }}-${{ matrix.file_tag.tag_suffix }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache From 659f107b4bd08a538daf2bd54c1ccc2b5c3de8b3 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 18:46:00 +0800 Subject: [PATCH 14/15] typo Signed-off-by: Jared Tan --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 160028ede3..cd7c1b085d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,7 +46,7 @@ jobs: - file: ./src/recommendationservice/Dockerfile tag_suffix: recommendationservice - file: ./src/frontend/Dockerfile.cypress - tag_suffix; frontend-tests + tag_suffix: frontend-tests - file: ./test/Dockerfile tag_suffix: integrationTests steps: From 750943b4f10ddb7d1d7178d44742263eeaf45ded Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Wed, 19 Oct 2022 22:35:58 +0800 Subject: [PATCH 15/15] revert update .env Signed-off-by: Jared Tan --- .github/workflows/release.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd7c1b085d..1463e547b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,6 +54,17 @@ jobs: with: fetch-depth: 0 + - name: Update .env + run: sed -i "s/IMAGE_VERSION=.*/IMAGE_VERSION=${RELEASE_VERSION}/" .env + + - name: Commit updated .env file + uses: test-room-7/action-update-file@v1 + with: + file: .env + commit-message: "Update .env file with release version" + branch: main + github-token: ${{ secrets.GITHUB_TOKEN }} + # limit docker push image concurrency to 1 # to avoid github package return 429 ratelimit error - name: Set docker upload concurrent