-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathazure-pipelines-python-kv.yml
121 lines (100 loc) · 3.43 KB
/
azure-pipelines-python-kv.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
114
115
116
117
118
119
120
121
pool:
vmImage: 'ubuntu-18.04'
variables:
- name: dockerFilePath
value: 'samples/pod_identity/python/api_kv_demo//src/Dockerfile'
- name: releaseName
value: 'pythondemo'
- name: chartFilePath
value: '$(System.DefaultWorkingDirectory)/samples/pod_identity/python/api_kv_demo/chart'
- name: acrServiceConnection
value: 'dockersvc'
- name: acrRepo
value: 'pythondemo'
- name: helmArtifactName
value: 'pythondemochart'
- name: kubernetesServiceConnection
value: 'aks-sa-demo'
- name: namespace
value: 'demo'
- name: host
value: 'c2f18e30623f44dd849b.eastus2.aksapp.io'
- name: keyValue
value: https://aksidentitydemo.vault.azure.net/
stages:
- stage: dockerbuild
displayName: 'Docker Build'
jobs:
- deployment: dockerbuild
environment: dockerDemo
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: $(acrServiceConnection)
- task: Docker@2
displayName: Build image
inputs:
repository: $(acrRepo)
command: build
Dockerfile: $(dockerFilePath)
containerRegistry: $(acrServiceConnection)
tags: |
$(Build.BuildId)
$(Build.SourceVersion)
- task: Docker@2
displayName: Push image
inputs:
repository: $(acrRepo)
command: push
Dockerfile: $(dockerFilePath)
containerRegistry: $(acrServiceConnection)
tags: $(Build.BuildId)
- task: Docker@2
displayName: Logout from ACR
condition: always()
inputs:
command: logout
containerRegistry: $(acrServiceConnection)
- task: PublishPipelineArtifact@1
condition: succeeded()
inputs:
targetPath: '$(chartFilePath)'
artifact: $(helmArtifactName)
publishLocation: 'pipeline'
- stage: deploypythonApp
dependsOn: 'dockerbuild'
displayName: 'Deploy Python Demo'
condition: and(succeeded(),eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment: helmdeploy
environment: charpdemo
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: $(helmArtifactName)
- task: HelmInstaller@0
displayName: 'Install Helm 3.2.0'
inputs:
helmVersion: 3.2.0
checkLatestHelmVersion: false
- task: HelmDeploy@0
displayName: Deploy to Demo
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: $(kubernetesServiceConnection)
namespace: $(namespace)
command: 'upgrade'
chartType: 'FilePath'
chartPath: '$(Pipeline.Workspace)/$(helmArtifactName)'
releaseName: $(releaseName)
install: true
waitForExecution: false
arguments: '--set image.tag=$(Build.BuildId) --set ingress.host=$(host) --set keyvault=$(keyValue) --set namespace=$(namespace) '