From 8a172a48d5a17e6c641e66bdcdd7c271201591eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 10:58:24 -0300 Subject: [PATCH 01/11] Create az-test.yml --- .github/workflows/az-test.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/az-test.yml diff --git a/.github/workflows/az-test.yml b/.github/workflows/az-test.yml new file mode 100644 index 00000000..1ad6bbca --- /dev/null +++ b/.github/workflows/az-test.yml @@ -0,0 +1,21 @@ +name: Run Azure Login with OIDC +on: [push] + +permissions: + id-token: write + contents: read +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: 'Az CLI login' + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - name: 'Run az commands' + run: | + az account show + az group list From 2092a80e5111f9c0341bca7f138f179e370ecb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 11:02:55 -0300 Subject: [PATCH 02/11] Update az-test.yml add environment to job --- .github/workflows/az-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/az-test.yml b/.github/workflows/az-test.yml index 1ad6bbca..df5c0897 100644 --- a/.github/workflows/az-test.yml +++ b/.github/workflows/az-test.yml @@ -7,6 +7,7 @@ permissions: jobs: build-and-deploy: runs-on: ubuntu-latest + environment: build steps: - name: 'Az CLI login' uses: azure/login@v1 From 5280cf612af2688ebe5587ec52003fcac3cd9850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 11:50:16 -0300 Subject: [PATCH 03/11] Update az-test.yml Try to build images --- .github/workflows/az-test.yml | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/az-test.yml b/.github/workflows/az-test.yml index df5c0897..cf07abe2 100644 --- a/.github/workflows/az-test.yml +++ b/.github/workflows/az-test.yml @@ -1,22 +1,42 @@ name: Run Azure Login with OIDC -on: [push] +on: + push: + branches: + - dev + - main + pull_request: + branches: + - dev + - main + workflow_dispatch: permissions: id-token: write contents: read jobs: - build-and-deploy: + build-orchestrator: runs-on: ubuntu-latest environment: build + strategy: + matrix: + include: + - dockerfile: Dockerfile-api_orchestrator + image-name: terravibes-api-orchestrator + - dockerfile: Dockerfile-worker + image-name: terravibes-worker + - dockerfile: Dockerfile-cache + image-name: terravibes-cache steps: + - uses: actions/checkout@v4 - name: 'Az CLI login' uses: azure/login@v1 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - - name: 'Run az commands' + - name: 'Build and push image' run: | - az account show - az group list + az acr login -n ${{ secrets.ACR_NAME }} + docker build -f ./resources/${{ matrix.dockerfile }} -t ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test + docker push ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test + From c38ca0f9f83f9ca87509a7023a2b94091255dce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 11:51:45 -0300 Subject: [PATCH 04/11] Update az-test.yml Add . --- .github/workflows/az-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/az-test.yml b/.github/workflows/az-test.yml index cf07abe2..7c441a9e 100644 --- a/.github/workflows/az-test.yml +++ b/.github/workflows/az-test.yml @@ -1,4 +1,4 @@ -name: Run Azure Login with OIDC +name: Build service images on: push: branches: @@ -14,7 +14,7 @@ permissions: id-token: write contents: read jobs: - build-orchestrator: + build-and-push: runs-on: ubuntu-latest environment: build strategy: @@ -37,6 +37,6 @@ jobs: - name: 'Build and push image' run: | az acr login -n ${{ secrets.ACR_NAME }} - docker build -f ./resources/${{ matrix.dockerfile }} -t ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test + docker build . -f ./resources/${{ matrix.dockerfile }} -t ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test docker push ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test From d7ee5daf2c935ad209a6bd7c7aafd043dbaef13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 11:53:52 -0300 Subject: [PATCH 05/11] Update az-test.yml Fix path to dockerfile --- .github/workflows/az-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/az-test.yml b/.github/workflows/az-test.yml index 7c441a9e..4ac1ac3d 100644 --- a/.github/workflows/az-test.yml +++ b/.github/workflows/az-test.yml @@ -37,6 +37,6 @@ jobs: - name: 'Build and push image' run: | az acr login -n ${{ secrets.ACR_NAME }} - docker build . -f ./resources/${{ matrix.dockerfile }} -t ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test + docker build . -f ./resources/docker/${{ matrix.dockerfile }} -t ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test docker push ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test From a32b5df77b8873ebe5c5f878ccdc8370668f2cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 12:08:04 -0300 Subject: [PATCH 06/11] Update az-test.yml Push to the correct repo --- .github/workflows/az-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/az-test.yml b/.github/workflows/az-test.yml index 4ac1ac3d..e627c44c 100644 --- a/.github/workflows/az-test.yml +++ b/.github/workflows/az-test.yml @@ -21,11 +21,11 @@ jobs: matrix: include: - dockerfile: Dockerfile-api_orchestrator - image-name: terravibes-api-orchestrator + image-name: api-orchestrator - dockerfile: Dockerfile-worker - image-name: terravibes-worker + image-name: worker - dockerfile: Dockerfile-cache - image-name: terravibes-cache + image-name: cache steps: - uses: actions/checkout@v4 - name: 'Az CLI login' @@ -37,6 +37,6 @@ jobs: - name: 'Build and push image' run: | az acr login -n ${{ secrets.ACR_NAME }} - docker build . -f ./resources/docker/${{ matrix.dockerfile }} -t ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test + docker build . -f ./resources/docker/${{ matrix.dockerfile }} -t ${{ secrets.ACR_NAME }}.azurecr.io/unlisted/farmai/terravibes/${{ matrix.image-name }}:test docker push ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test From 37e685b5fa175de1a15e8c44b19e4b9fad4d8ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 12:11:36 -0300 Subject: [PATCH 07/11] Update az-test.yml fix image name --- .github/workflows/az-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/az-test.yml b/.github/workflows/az-test.yml index e627c44c..4fa44cab 100644 --- a/.github/workflows/az-test.yml +++ b/.github/workflows/az-test.yml @@ -37,6 +37,7 @@ jobs: - name: 'Build and push image' run: | az acr login -n ${{ secrets.ACR_NAME }} - docker build . -f ./resources/docker/${{ matrix.dockerfile }} -t ${{ secrets.ACR_NAME }}.azurecr.io/unlisted/farmai/terravibes/${{ matrix.image-name }}:test - docker push ${{ secrets.ACR_NAME }}.azurecr.io/${{ matrix.image-name }}:test + export IMAGE_TAG=${{ secrets.ACR_NAME }}.azurecr.io/unlisted/farmai/terravibes/${{ matrix.image-name }}:test + docker build . -f ./resources/docker/${{ matrix.dockerfile }} -t $IMAGE_TAG + docker push $IMAGE_TAG From 954bf4064b219bc74b723f57960cdd36c16ec756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 12:22:41 -0300 Subject: [PATCH 08/11] Update and rename az-test.yml to docker-build.yml Rename yml --- .github/workflows/{az-test.yml => docker-build.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{az-test.yml => docker-build.yml} (100%) diff --git a/.github/workflows/az-test.yml b/.github/workflows/docker-build.yml similarity index 100% rename from .github/workflows/az-test.yml rename to .github/workflows/docker-build.yml From c53ea6df0c744783953c3b99ce79a22dfbee863a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 12:52:24 -0300 Subject: [PATCH 09/11] Update docker-build.yml --- .github/workflows/docker-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 4fa44cab..b8c8aa72 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -8,7 +8,6 @@ on: branches: - dev - main - workflow_dispatch: permissions: id-token: write @@ -37,7 +36,8 @@ jobs: - name: 'Build and push image' run: | az acr login -n ${{ secrets.ACR_NAME }} - export IMAGE_TAG=${{ secrets.ACR_NAME }}.azurecr.io/unlisted/farmai/terravibes/${{ matrix.image-name }}:test + export VERSION_TAG=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + export IMAGE_TAG=${{ secrets.ACR_NAME }}.azurecr.io/unlisted/farmai/terravibes/${{ matrix.image-name }}:$VERSION_TAG docker build . -f ./resources/docker/${{ matrix.dockerfile }} -t $IMAGE_TAG docker push $IMAGE_TAG From 62c745ca87cb965bc2ff087e119984990075699c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 12:55:12 -0300 Subject: [PATCH 10/11] Update docker-build.yml Fix version tag --- .github/workflows/docker-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index b8c8aa72..4413417e 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -36,7 +36,7 @@ jobs: - name: 'Build and push image' run: | az acr login -n ${{ secrets.ACR_NAME }} - export VERSION_TAG=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + export VERSION_TAG=${GITHUB_REF#refs/heads/} export IMAGE_TAG=${{ secrets.ACR_NAME }}.azurecr.io/unlisted/farmai/terravibes/${{ matrix.image-name }}:$VERSION_TAG docker build . -f ./resources/docker/${{ matrix.dockerfile }} -t $IMAGE_TAG docker push $IMAGE_TAG From f9a60a7edb99784b8ac0ba85735c0f1880bcd892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20de=20Moura=20Estev=C3=A3o=20Filho?= Date: Tue, 30 Jul 2024 13:02:56 -0300 Subject: [PATCH 11/11] Update docker-build.yml Only run workflow on push --- .github/workflows/docker-build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 4413417e..daca6037 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -4,10 +4,6 @@ on: branches: - dev - main - pull_request: - branches: - - dev - - main permissions: id-token: write