From f4c48d4b8fb33acfcafe579bed3f6afec45fcb30 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Sat, 27 Feb 2021 21:40:49 +0000 Subject: [PATCH 1/5] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..26d103c76 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,34 @@ + +# Adding extra information into build name, to make it easier to identify builds. +# It can be called using '$(Build.BuildNumber)' +name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) + +pool: + vmImage: ubuntu-latest + +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' + checkStyleRunAnalysis: true + goals: 'package' + + - 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 \ No newline at end of file From dcaa4b71cb1af61ee7a8a54186c2ca577c4981f6 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Sat, 27 Feb 2021 22:04:25 +0000 Subject: [PATCH 2/5] Changed: Replaced deprecated upload task with publish artifact --- azure-pipelines.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 26d103c76..676ecd729 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,10 +1,16 @@ +# DEVELOPMENT OPERATIONS CONTINUOUS ASSESSMENT + +pool: + # Using an Azure DevOps hosted agent. The advantages are: + # - The build VM is deployed by Microsoft, reducing maintenance. + # - Tools within the VM Image are always up to date. + # - Fresh build environment for every run (to reduce contamination from other runs). + # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml + vmImage: ubuntu-20.04 # Adding extra information into build name, to make it easier to identify builds. # It can be called using '$(Build.BuildNumber)' -name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) - -pool: - vmImage: ubuntu-latest +name: $(Build.DefinitionName)-$(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.r) jobs: - job: BuildTest @@ -21,7 +27,6 @@ jobs: publishJUnitResults: true testRunTitle: '$(Build.BuildNumber)' testResultsFiles: '**/TEST-*.xml' - checkStyleRunAnalysis: true goals: 'package' - task: CopyFiles@2 @@ -30,5 +35,14 @@ jobs: SourceFolder: '$(System.DefaultWorkingDirectory)' Contents: '**/target/*.?(war|jar)' TargetFolder: $(Build.ArtifactStagingDirectory) - - upload: $(Build.ArtifactStagingDirectory) - artifact: drop \ No newline at end of file + 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)' + 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. From b979266f3f30097f98cc6930f763af85338b6e2a Mon Sep 17 00:00:00 2001 From: James Flynn Date: Sat, 27 Feb 2021 22:11:34 +0000 Subject: [PATCH 3/5] Changed: Pipeline name structure --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 676ecd729..eb04b7921 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,7 +10,7 @@ pool: # Adding extra information into build name, to make it easier to identify builds. # It can be called using '$(Build.BuildNumber)' -name: $(Build.DefinitionName)-$(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.r) +name: $(Build.DefinitionName).$(SourceBranchName).$(Date:yyyyMMdd)$(Rev:.r) jobs: - job: BuildTest From 49a5add220bea68c99169e36d9483ccb464e20e9 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Sat, 27 Feb 2021 22:13:56 +0000 Subject: [PATCH 4/5] Changed: Source path to exclude target subdir from copy --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index eb04b7921..d2482c7c9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -32,7 +32,7 @@ jobs: - task: CopyFiles@2 displayName: 'Copy Files to artifact staging directory' inputs: - SourceFolder: '$(System.DefaultWorkingDirectory)' + SourceFolder: '$(System.DefaultWorkingDirectory)/target' Contents: '**/target/*.?(war|jar)' TargetFolder: $(Build.ArtifactStagingDirectory) preserveTimestamp: true @@ -41,7 +41,7 @@ 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)' + pathToPublish: '$(Build.ArtifactStagingDirectory)/target' artifactName: 'jar-artifact' publishLocation: 'Container' # Publishes inside Azure Pipelines artifact folder. parallel: true # Increased speed through multi-threaded copying. From 12a9343c70a65799338a815c42026da52a7196a3 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Sat, 27 Feb 2021 22:20:56 +0000 Subject: [PATCH 5/5] Fixed: Source path for JAR --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d2482c7c9..ba12fd40c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -32,7 +32,7 @@ jobs: - task: CopyFiles@2 displayName: 'Copy Files to artifact staging directory' inputs: - SourceFolder: '$(System.DefaultWorkingDirectory)/target' + SourceFolder: '$(System.DefaultWorkingDirectory)' Contents: '**/target/*.?(war|jar)' TargetFolder: $(Build.ArtifactStagingDirectory) preserveTimestamp: true