From 49b5d92275cac9060210a276eded1f22788744a6 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Mon, 1 Mar 2021 19:18:43 +0000 Subject: [PATCH 1/7] Added: Deploy Web App job --- azure-pipelines.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ba12fd40c..1ca7835c0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -46,3 +46,13 @@ jobs: publishLocation: 'Container' # Publishes inside Azure Pipelines artifact folder. parallel: true # Increased speed through multi-threaded copying. parallelCount: 8 # Dependent upon CPU capabilities. + + - job: DeployWebApp + steps: + - task: AzureWebApp@1 + inputs: + azureSubscription: 'azure-svc-connection' + appType: webAppLinux + appName: 'james-pet-clinic' + package: '$(System.DefaultWorkingDirectory)/**/*.jar' + \ No newline at end of file From 0925d196e8e54a65678181e69a6ca105f86836c8 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Mon, 1 Mar 2021 19:27:44 +0000 Subject: [PATCH 2/7] Removed: Publish artifacts steps for testing --- azure-pipelines.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1ca7835c0..481f56c7d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,23 +29,23 @@ jobs: testResultsFiles: '**/TEST-*.xml' goals: 'package' - - task: CopyFiles@2 - displayName: 'Copy Files to artifact staging directory' - inputs: - SourceFolder: '$(System.DefaultWorkingDirectory)' - Contents: '**/target/*.?(war|jar)' - TargetFolder: $(Build.ArtifactStagingDirectory) - preserveTimestamp: true + #- task: CopyFiles@2 + # displayName: 'Copy Files to artifact staging directory' + # inputs: + # SourceFolder: '$(System.DefaultWorkingDirectory)' + # Contents: '**/target/*.?(war|jar)' + # TargetFolder: $(Build.ArtifactStagingDirectory) + # preserveTimestamp: true # Publish build artifacts to Azure Pipelines. Extension uses Robocopy "under the hood." # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: '$(Build.ArtifactStagingDirectory)/target' - artifactName: 'jar-artifact' - publishLocation: 'Container' # Publishes inside Azure Pipelines artifact folder. - parallel: true # Increased speed through multi-threaded copying. - parallelCount: 8 # Dependent upon CPU capabilities. + #- task: PublishBuildArtifacts@1 + # inputs: + # pathToPublish: '$(Build.ArtifactStagingDirectory)/target' + # artifactName: 'jar-artifact' + # publishLocation: 'Container' # Publishes inside Azure Pipelines artifact folder. + # parallel: true # Increased speed through multi-threaded copying. + # parallelCount: 8 # Dependent upon CPU capabilities. - job: DeployWebApp steps: @@ -54,5 +54,5 @@ jobs: azureSubscription: 'azure-svc-connection' appType: webAppLinux appName: 'james-pet-clinic' - package: '$(System.DefaultWorkingDirectory)/**/*.jar' + package: '$(System.DefaultWorkingDirectory)/target/*.jar' \ No newline at end of file From dc893d663d35d0084819c60d7842af39550c4879 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Mon, 1 Mar 2021 19:37:39 +0000 Subject: [PATCH 3/7] Changed: Disabled tests for run time --- azure-pipelines.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 481f56c7d..69bec25d6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,9 +24,9 @@ jobs: javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' - publishJUnitResults: true - testRunTitle: '$(Build.BuildNumber)' - testResultsFiles: '**/TEST-*.xml' + #publishJUnitResults: true + #testRunTitle: '$(Build.BuildNumber)' + #testResultsFiles: '**/TEST-*.xml' goals: 'package' #- task: CopyFiles@2 @@ -41,18 +41,16 @@ jobs: # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops #- task: PublishBuildArtifacts@1 # inputs: - # pathToPublish: '$(Build.ArtifactStagingDirectory)/target' + # pathToPublish: '$(Build.DefaultWorkingDirectory)/target' # artifactName: 'jar-artifact' # publishLocation: 'Container' # Publishes inside Azure Pipelines artifact folder. # parallel: true # Increased speed through multi-threaded copying. # parallelCount: 8 # Dependent upon CPU capabilities. - - job: DeployWebApp - steps: - task: AzureWebApp@1 inputs: azureSubscription: 'azure-svc-connection' appType: webAppLinux appName: 'james-pet-clinic' - package: '$(System.DefaultWorkingDirectory)/target/*.jar' + package: '$(System.DefaultWorkingDirectory)/**/*.jar' \ No newline at end of file From 06899e577076c713437aa5383a9005d42f8ed501 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Mon, 1 Mar 2021 19:55:57 +0000 Subject: [PATCH 4/7] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 69bec25d6..d9545dee6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,18 +16,18 @@ jobs: - job: BuildTest displayName: Build and Test Maven Project steps: - - task: Maven@3 - displayName: 'Maven Package' - inputs: - mavenPomFile: 'pom.xml' - mavenOptions: '-Xmx3072m' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' - jdkArchitectureOption: 'x64' - #publishJUnitResults: true - #testRunTitle: '$(Build.BuildNumber)' - #testResultsFiles: '**/TEST-*.xml' - goals: 'package' +# - task: Maven@3 +# displayName: 'Maven Package' +# inputs: +# mavenPomFile: 'pom.xml' +# mavenOptions: '-Xmx3072m' +# javaHomeOption: 'JDKVersion' +# jdkVersionOption: '1.11' +# jdkArchitectureOption: 'x64' +# publishJUnitResults: true +# testRunTitle: '$(Build.BuildNumber)' +# testResultsFiles: '**/TEST-*.xml' +# goals: 'package' #- task: CopyFiles@2 # displayName: 'Copy Files to artifact staging directory' @@ -47,7 +47,19 @@ jobs: # parallel: true # Increased speed through multi-threaded copying. # parallelCount: 8 # Dependent upon CPU capabilities. + # Enable this task for testing purposes, to reduce times by not building the code each pipeline run. + - task: DownloadPipelineArtifact@2 + inputs: + source: 'specific' + project: 'DevOps-CA-pipeline' + pipeline: 16 + path: '$(System.DefaultWorkingDirectory)/target/spring-petclinic-2.4.2.jar' + runVersion: 'latest' + - task: AzureWebApp@1 + displayName: Deploy spring-petclinic to Azure Web Apps service + # Only deploy from main branch (for release purposes) + # condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) inputs: azureSubscription: 'azure-svc-connection' appType: webAppLinux From 1b001480814d7ed0f463c7bc389fe020a0350dc9 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Mon, 1 Mar 2021 19:59:08 +0000 Subject: [PATCH 5/7] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 59 +++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d9545dee6..25450d379 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,45 +16,36 @@ jobs: - job: BuildTest displayName: Build and Test Maven Project steps: -# - task: Maven@3 -# displayName: 'Maven Package' -# inputs: -# mavenPomFile: 'pom.xml' -# mavenOptions: '-Xmx3072m' -# javaHomeOption: 'JDKVersion' -# jdkVersionOption: '1.11' -# jdkArchitectureOption: 'x64' -# publishJUnitResults: true -# testRunTitle: '$(Build.BuildNumber)' -# testResultsFiles: '**/TEST-*.xml' -# goals: 'package' + - task: Maven@3 + displayName: 'Maven Package' + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: true + testRunTitle: '$(Build.BuildNumber)' + testResultsFiles: '**/TEST-*.xml' + goals: 'package' - #- task: CopyFiles@2 - # displayName: 'Copy Files to artifact staging directory' - # inputs: - # SourceFolder: '$(System.DefaultWorkingDirectory)' - # Contents: '**/target/*.?(war|jar)' - # TargetFolder: $(Build.ArtifactStagingDirectory) - # preserveTimestamp: true + - task: CopyFiles@2 + displayName: 'Copy Files to artifact staging directory' + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)' + Contents: '**/target/*.?(war|jar)' + TargetFolder: $(Build.ArtifactStagingDirectory) + preserveTimestamp: true # Publish build artifacts to Azure Pipelines. Extension uses Robocopy "under the hood." # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops - #- task: PublishBuildArtifacts@1 - # inputs: - # pathToPublish: '$(Build.DefaultWorkingDirectory)/target' - # artifactName: 'jar-artifact' - # publishLocation: 'Container' # Publishes inside Azure Pipelines artifact folder. - # parallel: true # Increased speed through multi-threaded copying. - # parallelCount: 8 # Dependent upon CPU capabilities. - - # Enable this task for testing purposes, to reduce times by not building the code each pipeline run. - - task: DownloadPipelineArtifact@2 + - task: PublishBuildArtifacts@1 inputs: - source: 'specific' - project: 'DevOps-CA-pipeline' - pipeline: 16 - path: '$(System.DefaultWorkingDirectory)/target/spring-petclinic-2.4.2.jar' - runVersion: 'latest' + pathToPublish: '$(Build.DefaultWorkingDirectory)/target' + artifactName: 'jar-artifact' + publishLocation: 'Container' # Publishes inside Azure Pipelines artifact folder. + parallel: true # Increased speed through multi-threaded copying. + parallelCount: 8 # Dependent upon CPU capabilities. - task: AzureWebApp@1 displayName: Deploy spring-petclinic to Azure Web Apps service From 32de58ba0c527e08633807e71b64d20df8e7c7bc Mon Sep 17 00:00:00 2001 From: James Flynn Date: Mon, 1 Mar 2021 20:00:37 +0000 Subject: [PATCH 6/7] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 25450d379..ceaaaadd5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -49,11 +49,11 @@ jobs: - task: AzureWebApp@1 displayName: Deploy spring-petclinic to Azure Web Apps service - # Only deploy from main branch (for release purposes) - # condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) inputs: azureSubscription: 'azure-svc-connection' appType: webAppLinux appName: 'james-pet-clinic' package: '$(System.DefaultWorkingDirectory)/**/*.jar' + # Only deploy web app from main branch (for release purposes) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) \ No newline at end of file From 226366c9aef4106438de7758309625ce6b813f6b Mon Sep 17 00:00:00 2001 From: James Flynn Date: Mon, 1 Mar 2021 20:09:58 +0000 Subject: [PATCH 7/7] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ceaaaadd5..b75afdd9f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,8 +13,8 @@ pool: name: $(Build.DefinitionName).$(SourceBranchName).$(Date:yyyyMMdd)$(Rev:.r) jobs: - - job: BuildTest - displayName: Build and Test Maven Project + - job: BuildTestDeploy + displayName: Build Test and Deploy spring-petclinic Java Web App steps: - task: Maven@3 displayName: 'Maven Package' @@ -41,14 +41,14 @@ jobs: # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops - task: PublishBuildArtifacts@1 inputs: - pathToPublish: '$(Build.DefaultWorkingDirectory)/target' + pathToPublish: '$(Build.ArtifactStagingDirectory)/target' artifactName: 'jar-artifact' publishLocation: 'Container' # Publishes inside Azure Pipelines artifact folder. parallel: true # Increased speed through multi-threaded copying. parallelCount: 8 # Dependent upon CPU capabilities. - task: AzureWebApp@1 - displayName: Deploy spring-petclinic to Azure Web Apps service + displayName: Deploy spring-petclinic to Azure Web App service inputs: azureSubscription: 'azure-svc-connection' appType: webAppLinux