-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
96 lines (81 loc) · 2.99 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
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
resources:
repositories:
- repository: helmrepo
type: github
name: utkarshpoc/azure-vote-helm-chart
endpoint: github
variables:
acr.name: acrdemoutkarsh
acr.repo.name: helmdemo/vote-app
HELM_EXPERIMENTAL_OCI: 1
stages:
- stage: ci
displayName: CI
jobs:
- job: helm_publish_acr
displayName: helm chart publish
steps:
- checkout: helmrepo
displayName: download chart
- script: |
ls $(build.sourcesdirectory)/src
displayName: list contents
- task: HelmInstaller@0
displayName: install helm
inputs:
helmVersion: 'latest'
installKubectl: false
- script: |
echo "$(acr.push.password)" | helm registry login $(acr.name).azurecr.io --username $(acr.push.username) --password-stdin
displayName: login to acr using helm
- script: |
helm chart save $(build.sourcesdirectory)/src/azure-vote-helm-chart/ $(acr.name).azurecr.io/$(acr.repo.name):latest
displayName: save the chart and set the alias
- script: |
helm chart push $(acr.name).azurecr.io/$(acr.repo.name):latest
displayName: push the chart to acr
- stage: cd
displayName: CD
dependsOn: ci
jobs:
- deployment: helm_publish_aks
displayName: deploy to aks
environment:
name: PROD
resourceName: helmdemo
resourceType: Kubernetes
strategy:
runOnce:
deploy:
steps:
- task: HelmInstaller@0
displayName: install helm
inputs:
helmVersion: 'latest'
installKubectl: false
- script: |
echo "$(acr.pull.password)" | helm registry login $(acr.name).azurecr.io --username $(acr.pull.username) --password-stdin
displayName: login to acr using helm
- bash: |
helm chart pull $(acr.name).azurecr.io/$(acr.repo.name):latest
displayName: get helm chart on agent
- bash: |
helm chart export $(acr.name).azurecr.io/$(acr.repo.name):latest --destination $(build.stagingdirectory)
displayName: export the chart to folder
- task: HelmDeploy@0
displayName: deploy chart to aks
inputs:
connectionType: 'Azure Resource Manager'
azureSubscription: '$(azure.service.connection)'
azureResourceGroup: 'demos'
kubernetesCluster: 'aksdemoutkarsh'
namespace: 'helmdemo'
command: 'upgrade'
chartType: 'FilePath'
chartPath: '$(build.stagingdirectory)/azure-vote/'
releaseName: 'helmdemo'
arguments: '--create-namespace --install'