mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 07:45:49 +00:00
Added: improved commenting and references
This commit is contained in:
parent
cb962d7e55
commit
1eb273dcec
1 changed files with 23 additions and 6 deletions
|
@ -5,11 +5,12 @@ pool:
|
||||||
# - The build VM is deployed by Microsoft, reducing maintenance.
|
# - The build VM is deployed by Microsoft, reducing maintenance.
|
||||||
# - Tools within the VM Image are always up to date.
|
# - Tools within the VM Image are always up to date.
|
||||||
# - Fresh build environment for every run (to reduce contamination from other runs).
|
# - 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
|
# see: https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml
|
||||||
vmImage: ubuntu-20.04
|
vmImage: ubuntu-20.04
|
||||||
|
|
||||||
# Adding extra information into build name, to make it easier to identify builds.
|
# Adding extra information into build name, to make it easier to identify builds.
|
||||||
# It can be called using '$(Build.BuildNumber)'
|
# It can be called using '$(Build.BuildNumber)'
|
||||||
|
# see: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/run-number?view=azure-devops&tabs=yaml
|
||||||
name: $(Build.DefinitionName).$(SourceBranchName).$(Date:yyyyMMdd)$(Rev:.r)
|
name: $(Build.DefinitionName).$(SourceBranchName).$(Date:yyyyMMdd)$(Rev:.r)
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -17,23 +18,31 @@ jobs:
|
||||||
displayName: Build Test and Deploy spring-petclinic Java Web App
|
displayName: Build Test and Deploy spring-petclinic Java Web App
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
# Azure DevOps extension for configuring SonarCloud properties
|
||||||
|
# see: https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud
|
||||||
- task: SonarCloudPrepare@1
|
- task: SonarCloudPrepare@1
|
||||||
displayName: 'Prepare SonarCloud Code Analysis Scan'
|
displayName: 'Prepare SonarCloud Code Analysis Scan'
|
||||||
inputs:
|
inputs:
|
||||||
|
# Azure DevOps Service Connection is used in place of secureSonar Token value within repo.
|
||||||
|
# For configuring, see: https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml
|
||||||
SonarCloud: 'sonarcloud-svc-connection'
|
SonarCloud: 'sonarcloud-svc-connection'
|
||||||
organization: 'james-flynn-ie'
|
organization: 'james-flynn-ie'
|
||||||
scannerMode: 'Other'
|
scannerMode: 'Other'
|
||||||
ProjectKey: 'james-flynn-ie_spring-petclinic'
|
ProjectKey: 'james-flynn-ie_spring-petclinic'
|
||||||
ProjectName: 'spring-petclinic'
|
ProjectName: 'spring-petclinic'
|
||||||
extraProperties: |
|
extraProperties: |
|
||||||
|
# see: https://sonarcloud.io/documentation/analysis/analysis-parameters/
|
||||||
sonar.branch.name=$(Build.SourceBranchName)
|
sonar.branch.name=$(Build.SourceBranchName)
|
||||||
sonar.language=java
|
sonar.language=java
|
||||||
sonar.projectKey=james-flynn-ie_spring-petclinic
|
sonar.projectKey=james-flynn-ie_spring-petclinic
|
||||||
|
|
||||||
|
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/maven?view=azure-devops
|
||||||
- task: Maven@3
|
- task: Maven@3
|
||||||
displayName: 'Maven Build, Test and Package'
|
displayName: 'Maven Build, Test and Package'
|
||||||
inputs:
|
inputs:
|
||||||
mavenPomFile: 'pom.xml'
|
mavenPomFile: 'pom.xml'
|
||||||
|
# 'clean install sonar:sonar' is required to run the Sonarcloud scan ('package' creates the JAR).
|
||||||
|
# see: https://www.coachdevops.com/2020/04/how-to-integrate-sonarqube-in-azure.html
|
||||||
goals: 'clean install sonar:sonar package'
|
goals: 'clean install sonar:sonar package'
|
||||||
publishJUnitResults: true
|
publishJUnitResults: true
|
||||||
testResultsFiles: '**/TEST-*.xml'
|
testResultsFiles: '**/TEST-*.xml'
|
||||||
|
@ -47,14 +56,14 @@ jobs:
|
||||||
sonarQubeRunAnalysis: true
|
sonarQubeRunAnalysis: true
|
||||||
sqMavenPluginVersionChoice: 'latest'
|
sqMavenPluginVersionChoice: 'latest'
|
||||||
|
|
||||||
- task: SonarCloudAnalyze@1
|
# Adds results and link to sonarcloud.io reports under 'Extensions' tab on pipeline run report.
|
||||||
displayName: 'Run Sonarcloud Code Analysis'
|
# see: https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud
|
||||||
|
|
||||||
- task: SonarCloudPublish@1
|
- task: SonarCloudPublish@1
|
||||||
displayName: 'Publish Quality Gate Result on SonarCloud'
|
displayName: 'Publish Quality Gate Result on SonarCloud'
|
||||||
inputs:
|
inputs:
|
||||||
pollingTimeoutSec: '300'
|
pollingTimeoutSec: '300'
|
||||||
|
|
||||||
|
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/copy-files?view=azure-devops&tabs=yaml
|
||||||
- task: CopyFiles@2
|
- task: CopyFiles@2
|
||||||
displayName: 'Copy Files to artifact staging directory'
|
displayName: 'Copy Files to artifact staging directory'
|
||||||
inputs:
|
inputs:
|
||||||
|
@ -63,7 +72,8 @@ jobs:
|
||||||
TargetFolder: $(Build.ArtifactStagingDirectory)
|
TargetFolder: $(Build.ArtifactStagingDirectory)
|
||||||
preserveTimestamp: true
|
preserveTimestamp: true
|
||||||
|
|
||||||
# Publish build artifacts to Azure Pipelines. Extension uses Robocopy "under the hood."
|
# Publish build artifacts to Azure Pipelines (Continuous Delivery).
|
||||||
|
# Build artifacts are retained and can be downloaded for local use, or used in other stages or pipeline runs for deployments.
|
||||||
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops
|
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
inputs:
|
inputs:
|
||||||
|
@ -73,13 +83,20 @@ jobs:
|
||||||
parallel: true # Increased speed through multi-threaded copying.
|
parallel: true # Increased speed through multi-threaded copying.
|
||||||
parallelCount: 8 # Dependent upon CPU capabilities.
|
parallelCount: 8 # Dependent upon CPU capabilities.
|
||||||
|
|
||||||
|
# Deploy JAR into Azure Web App Service https://docs.microsoft.com/en-us/azure/app-service/overview
|
||||||
|
# Azure App Service offers a Web application hosting Platform-as-a-Service, offering:
|
||||||
|
# - Security
|
||||||
|
# - Load balancing
|
||||||
|
# - High Availability and autoscaling (based on policies)
|
||||||
|
# For pipeline configuration, see: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-rm-web-app?view=azure-devops
|
||||||
- task: AzureWebApp@1
|
- task: AzureWebApp@1
|
||||||
displayName: Deploy spring-petclinic to Azure Web App service
|
displayName: Deploy spring-petclinic to Azure Web App service
|
||||||
inputs:
|
inputs:
|
||||||
|
# For configuring Service Connection, see: https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml
|
||||||
azureSubscription: 'azure-svc-connection'
|
azureSubscription: 'azure-svc-connection'
|
||||||
appType: webAppLinux
|
appType: webAppLinux
|
||||||
appName: 'james-pet-clinic'
|
appName: 'james-pet-clinic'
|
||||||
package: '$(System.DefaultWorkingDirectory)/**/*.jar'
|
package: '$(System.DefaultWorkingDirectory)/**/*.jar'
|
||||||
# Only deploy web app from main branch (for release purposes)
|
# Only deploy web app from main branch (for release purposes)
|
||||||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
|
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
|
||||||
|
...
|
||||||
|
|
Loading…
Reference in a new issue