-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
110 lines (102 loc) · 3.71 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
trigger:
tags:
include:
- '*'
branches:
include:
- 'cr*'
pr:
- master
- cr*
variables:
# Agent VM image name
vmImageName: 'ubuntu-20.04'
stages:
- stage: Build
displayName: Build stage
jobs:
- job: MavenBuild
displayName: Maven Package and Publish Artifacts
pool:
vmImage: $(vmImageName)
steps:
- task: Maven@3
displayName: 'Maven Package'
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
options: '-Dspring.flyway.enabled=false'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
goals: 'package spring-boot:repackage'
- task: CopyFiles@2
displayName: 'Copy Files to artifact staging directory'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/target'
Contents: '*.?(war|jar)'
TargetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
displayName: 'Publish pipeline artifacts'
inputs:
targetPath: $(Build.ArtifactStagingDirectory)
- stage:
displayName: Deploy to dev/test environment
dependsOn: Build
condition: and(succeeded(), or(eq(variables['Build.Reason'], 'PullRequest'), startsWith(variables['build.sourceBranch'], 'refs/heads/cr')))
jobs:
- deployment: DeployLinuxWebAppDev
displayName: Deploy Linux Web App - TestDev
environment: 'dev'
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: Bash@3
inputs:
targetType: 'inline'
script: 'mv $(Pipeline.Workspace)/Build.MavenBuild/*.jar $(Pipeline.Workspace)/app.jar'
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'BEIS-Subsidy-Control-TestDev'
appType: 'webAppLinux'
WebAppName: 'dev-transparency-db-access-management-service'
packageForLinux: '$(Pipeline.Workspace)/app.jar'
- stage:
displayName: Deploy to staging environment
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
jobs:
- deployment: DeployLinuxWebAppStg
displayName: Deploy Linux Web App - Staging
environment: 'stg'
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: Bash@3
inputs:
targetType: 'inline'
script: 'mv $(Pipeline.Workspace)/Build.MavenBuild/*.jar $(Pipeline.Workspace)/app.jar'
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'BEIS-Subsidy-Control-Staging'
appType: 'webAppLinux'
WebAppName: 'stg-transparency-db-access-management-service'
packageForLinux: '$(Pipeline.Workspace)/app.jar'