From daf07805d9c14f90e508fada2f309f2691a3ba6f Mon Sep 17 00:00:00 2001 From: Pragyan <87907959+PragyanBeuria@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:32:49 +0530 Subject: [PATCH 1/9] Set up CI with Azure Pipelines-resaultapp-01 [skip ci] --- azure-pipelines.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..13645e096a --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,40 @@ +# Docker +# Build and push an image to Azure Container Registry +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: +- main + +resources: +- repo: self + +variables: + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: '64bdd185-ed43-42cd-9e22-93bee0445236' + imageRepository: 'azresultapp' + containerRegistry: 'mylab2024.azurecr.io' + dockerfilePath: '$(Build.SourcesDirectory)/result/Dockerfile' + tag: '$(Build.BuildId)' + + # Agent VM image name + pool: + poolz + +stages: +- stage: Build + displayName: Build and push stage + jobs: + - job: Build + displayName: Build + pool: + vmImage: $(vmImageName) + steps: + - task: Docker@2 + displayName: Build and push an image to container registry + inputs: + command: buildAndPush + repository: $(imageRepository) + dockerfile: $(dockerfilePath) + containerRegistry: $(dockerRegistryServiceConnection) + tags: | + $(tag) From 319b29711cad2932780b457d2adba7c7279f385a Mon Sep 17 00:00:00 2001 From: Pragyan <87907959+PragyanBeuria@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:46:27 +0530 Subject: [PATCH 2/9] Update azure-pipelines.yml for Azure Pipelines-result-01 --- azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 13645e096a..5a408f1459 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,7 +3,9 @@ # https://docs.microsoft.com/azure/devops/pipelines/languages/docker trigger: -- main + paths: + include: + - results/* resources: - repo: self From 82acd2529a64fc3a813389f45807bc2faa77fa3d Mon Sep 17 00:00:00 2001 From: Pragyan <87907959+PragyanBeuria@users.noreply.github.com> Date: Mon, 15 Apr 2024 19:09:49 +0530 Subject: [PATCH 3/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5a408f1459..9bbdf0d291 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,7 +29,7 @@ stages: - job: Build displayName: Build pool: - vmImage: $(vmImageName) + poolz steps: - task: Docker@2 displayName: Build and push an image to container registry From 0df9bf35ea5092fb43cdbed4196e54a786c755ce Mon Sep 17 00:00:00 2001 From: Pragyan <87907959+PragyanBeuria@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:21:32 +0530 Subject: [PATCH 4/9] Set up CI with Azure Pipelines-vote-01 [skip ci] --- azure-pipelines-1.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 azure-pipelines-1.yml diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 0000000000..067f8c7919 --- /dev/null +++ b/azure-pipelines-1.yml @@ -0,0 +1,39 @@ +# Docker +# Build and push an image to Azure Container Registry +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: + paths: + include: + - vote/* +resources: +- repo: self + +variables: + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: '6bbf1581-e456-477d-8d90-f6c230952911' + imageRepository: 'voteapp' + containerRegistry: 'mylab2024.azurecr.io' + dockerfilePath: '$(Build.SourcesDirectory)/result/Dockerfile' + tag: '$(Build.BuildId)' + + pool: + poolz +stages: +- stage: Build + displayName: Build and push stage + jobs: + - job: Build + displayName: Build + pool: + poolz + steps: + - task: Docker@2 + displayName: Build and push an image to container registry + inputs: + command: buildAndPush + repository: $(imageRepository) + dockerfile: $(dockerfilePath) + containerRegistry: $(dockerRegistryServiceConnection) + tags: | + $(tag) From de79b2a119e97d807e77e9d5875fc3fc0d91fd3c Mon Sep 17 00:00:00 2001 From: Pragyan <87907959+PragyanBeuria@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:24:13 +0530 Subject: [PATCH 5/9] Update azure-pipelines-1.yml for Azure Pipelines-vote-02 --- azure-pipelines-1.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 067f8c7919..e0d1c87099 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -29,11 +29,10 @@ stages: poolz steps: - task: Docker@2 - displayName: Build and push an image to container registry + displayName: Build image inputs: - command: buildAndPush - repository: $(imageRepository) - dockerfile: $(dockerfilePath) - containerRegistry: $(dockerRegistryServiceConnection) - tags: | - $(tag) + containerRegistry: '$(dockerRegistryServiceConnection)' + repository: '$(imageRepository)' + command: 'build' + Dockerfile: 'vote/Dockerfile' + tags: '$(tag)' From 02d6aa2c676cd8950defd7b6c1d91450a1cef5c8 Mon Sep 17 00:00:00 2001 From: Pragyan <87907959+PragyanBeuria@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:29:47 +0530 Subject: [PATCH 6/9] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index e0d1c87099..4d2e6cbf65 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -36,3 +36,20 @@ stages: command: 'build' Dockerfile: 'vote/Dockerfile' tags: '$(tag)' +- stage: Push + displayName: Push + jobs: + - job: Push + displayName: Push + pool: + poolz # Specify the self-hosted agent pool here + steps: + - task: Docker@2 + displayName: Push an image to container registry + inputs: + command: push + repository: $(imageRepository) + dockerfile: vote/dockerfilePath + containerRegistry: $(dockerRegistryServiceConnection) + tags: | + $(tag) \ No newline at end of file From 3bb49d024e67b3e3f443e986ffc5d4f648a244cf Mon Sep 17 00:00:00 2001 From: Pragyan <87907959+PragyanBeuria@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:35:59 +0530 Subject: [PATCH 7/9] Set up CI with Azure Pipelines-woker-01 [skip ci] --- azure-pipelines-2.yml | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 azure-pipelines-2.yml diff --git a/azure-pipelines-2.yml b/azure-pipelines-2.yml new file mode 100644 index 0000000000..5486757bea --- /dev/null +++ b/azure-pipelines-2.yml @@ -0,0 +1,55 @@ +# Docker +# Build and push an image to Azure Container Registry +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: + paths: + include: + - worker/* +resources: +- repo: self + +variables: + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: '6bbf1581-e456-477d-8d90-f6c230952911' + imageRepository: 'workerapp' + containerRegistry: 'mylab2024.azurecr.io' + dockerfilePath: '$(Build.SourcesDirectory)/result/Dockerfile' + tag: '$(Build.BuildId)' + + pool: + poolz +stages: +- stage: Build + displayName: Build and push stage + jobs: + - job: Build + displayName: Build + pool: + poolz + steps: + - task: Docker@2 + displayName: Build image + inputs: + containerRegistry: '$(dockerRegistryServiceConnection)' + repository: '$(imageRepository)' + command: 'build' + Dockerfile: 'worker/Dockerfile' + tags: '$(tag)' +- stage: Push + displayName: Push + jobs: + - job: Push + displayName: Push + pool: + poolz # Specify the self-hosted agent pool here + steps: + - task: Docker@2 + displayName: Push an image to container registry + inputs: + command: push + repository: $(imageRepository) + dockerfile: worker/dockerfilePath + containerRegistry: $(dockerRegistryServiceConnection) + tags: | + $(tag) \ No newline at end of file From b8fc8ad3cda17bef595a79a44d11f12bb0a34f1d Mon Sep 17 00:00:00 2001 From: Pragyan <87907959+PragyanBeuria@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:49:39 +0530 Subject: [PATCH 8/9] Update app.py --- vote/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vote/app.py b/vote/app.py index 596546612a..74a032f2ed 100644 --- a/vote/app.py +++ b/vote/app.py @@ -6,8 +6,8 @@ import json import logging -option_a = os.getenv('OPTION_A', "Cats") -option_b = os.getenv('OPTION_B', "Dogs") +option_a = os.getenv('OPTION_A', "Summer") +option_b = os.getenv('OPTION_B', "Winter") hostname = socket.gethostname() app = Flask(__name__) From 059be48ad91a747276ab0750b34af5503c6ea6c3 Mon Sep 17 00:00:00 2001 From: Pragyan <87907959+PragyanBeuria@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:19:46 +0530 Subject: [PATCH 9/9] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/main_loadvm1.yml | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/main_loadvm1.yml diff --git a/.github/workflows/main_loadvm1.yml b/.github/workflows/main_loadvm1.yml new file mode 100644 index 0000000000..7c8f4e7151 --- /dev/null +++ b/.github/workflows/main_loadvm1.yml @@ -0,0 +1,53 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy JAR app to Azure Web App - loadvm1 + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Java version + uses: actions/setup-java@v1 + with: + java-version: '11' + + - name: Build with Maven + run: mvn clean install + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v3 + with: + name: java-app + path: '${{ github.workspace }}/target/*.jar' + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v3 + with: + name: java-app + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: 'loadvm1' + slot-name: 'Production' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_99C6DD75542E45AFB582FBD98BCBAB76 }} + package: '*.jar'