-
Notifications
You must be signed in to change notification settings - Fork 0
/
az-cd-pipeline-prod.yml
113 lines (98 loc) · 3.05 KB
/
az-cd-pipeline-prod.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
110
111
112
113
trigger:
batch: true
branches:
include:
- prod
paths:
exclude:
- README.md
pr: none
variables:
agentOS: ubuntu-latest
azKeyVault: key-vault-greencity
jsonSecret: google-credentials
jsonFile: google-creds.json
jsonLocation: /site/wwwroot
artifactName: drop
userRepoName: core
onbootJarName: app.jar
azureSub: GreenCity2022
resourceGroup: GreenCity
userServiceName: greencity-user
stages:
- stage: Build
jobs:
- job: Build
pool:
vmImage: $(agentOS)
steps:
- task: Maven@3
displayName: Maven package
inputs:
mavenPomFile: 'pom.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
mavenVersionOption: 'Default'
options: '-Dmaven.test.skip=true'
- script: mv $(userRepoName)/target/*.jar $(userRepoName)/target/$(onbootJarName)
displayName: Rename user jar to app
- task: CopyFiles@2
displayName: Copy Files
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: '**/target/*.jar'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: CopyFiles@2
displayName: Copy Files
inputs:
SourceFolder: '$(system.defaultworkingdirectory)/greencity-user-chart'
Contents: '**'
TargetFolder: '$(build.artifactstagingdirectory)/greencity-user-chart'
- task: PublishBuildArtifacts@1
displayName: Publish Artifact
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
artifactName: '$(artifactName)'
- task: Docker@2
displayName: Build image
inputs:
containerRegistry: 'Dockerhub_Skyere'
repository: 'skyere/greencityuser'
command: 'buildAndPush'
Dockerfile: 'Dockerfile'
tags: |
$(Build.BuildId)
latest
- stage: Deploy
jobs:
- deployment: DeployUser
displayName: Deploy User app service
pool:
vmImage: $(agentOS)
environment: 'production'
strategy:
runOnce:
deploy:
steps:
- download: none
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: '$(artifactName)'
downloadPath: '$(System.ArtifactsDirectory)'
- task: HelmInstaller@0
inputs:
helmVersion: '3.9.0'
installKubectl: true
- task: HelmDeploy@0
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: 'production'
namespace: 'default'
command: 'upgrade'
chartType: 'FilePath'
chartPath: '$(System.ArtifactsDirectory)/drop/greencity-user-chart'
releaseName: 'user'
overrideValues: 'ingress.hostname=greencity-user.pick-up.city,deployment.image=skyere/greencityuser:$(Build.BuildId)'
arguments: '--debug'