From 61c641bda96125e0bdcddd5f7eb5a83f514e1286 Mon Sep 17 00:00:00 2001 From: dmitarb Date: Tue, 14 Nov 2023 21:32:59 +0000 Subject: [PATCH 1/2] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..a8f1370bb --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,68 @@ +# Maven package Java project Web App to Linux on Azure +# Build your Java project and deploy it to Azure as a Linux web app +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/java + +trigger: +- main + +variables: + + # Azure Resource Manager connection created during pipeline creation + azureSubscription: '78ceff19-e62b-453f-9873-ab22487bd785' + + # Web app name + webAppName: '' + + # Environment name + environmentName: '' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Build + displayName: Build stage + jobs: + - job: MavenPackageAndPublishArtifacts + displayName: Maven Package and Publish Artifacts + pool: + vmImage: $(vmImageName) + + steps: + - task: Maven@3 + displayName: 'Maven Package' + inputs: + mavenPomFile: 'pom.xml' + + - task: CopyFiles@2 + displayName: 'Copy Files to artifact staging directory' + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)' + Contents: '**/target/*.?(war|jar)' + TargetFolder: $(Build.ArtifactStagingDirectory) + + - upload: $(Build.ArtifactStagingDirectory) + artifact: drop + +- stage: Deploy + displayName: Deploy stage + dependsOn: Build + condition: succeeded() + jobs: + - deployment: DeployLinuxWebApp + displayName: Deploy Linux Web App + environment: $(environmentName) + pool: + vmImage: $(vmImageName) + strategy: + runOnce: + deploy: + steps: + - task: AzureWebApp@1 + displayName: 'Azure Web App Deploy: ' + inputs: + azureSubscription: $(azureSubscription) + appType: webAppLinux + appName: $(webAppName) + package: '$(Pipeline.Workspace)/drop/**/target/*.?(war|jar)' From 6518c95a2998e77d05ff4efce4fb32e5c7a0d412 Mon Sep 17 00:00:00 2001 From: dmitarb Date: Tue, 14 Nov 2023 21:36:00 +0000 Subject: [PATCH 2/2] update appname and env --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a8f1370bb..2d939fbe7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,10 +12,10 @@ variables: azureSubscription: '78ceff19-e62b-453f-9873-ab22487bd785' # Web app name - webAppName: '' + webAppName: 'java-example-pipeline' # Environment name - environmentName: '' + environmentName: 'dev' # Agent VM image name vmImageName: 'ubuntu-latest'