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' diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 0000000000..4d2e6cbf65 --- /dev/null +++ b/azure-pipelines-1.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: + - 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 image + inputs: + containerRegistry: '$(dockerRegistryServiceConnection)' + repository: '$(imageRepository)' + 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 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 diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..9bbdf0d291 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,42 @@ +# Docker +# Build and push an image to Azure Container Registry +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: + paths: + include: + - results/* + +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: + 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) 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__)