-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines-1.yml
98 lines (92 loc) · 2.75 KB
/
azure-pipelines-1.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
# Docker
# Build a Docker image
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- main
resources:
- repo: self
variables:
tag: $[replace(variables['Build.SourceBranch'], 'refs/heads/main','')]
containerBaseUrl: irissouthindia.azurecr.io
containerRepo: iris/iris-ui
replicaCount: '2'
stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: Bash@3
inputs:
targetType: 'inline'
script: 'echo $tag'
- task: Docker@2
inputs:
containerRegistry: 'iris-south-acr'
repository: 'iris/iris-ui'
command: 'buildAndPush'
Dockerfile: '**/Dockerfile'
tags: |
latest
$(tag)
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)/s/kubernetes'
artifact: 'manifest'
publishLocation: 'pipeline'
- stage: Deploy
dependsOn: Build
displayName: Deploy to AKS
variables:
acrsecret: iris-south-acr-auth
jobs:
- deployment: Deploy
displayName: Deploy
environment: 'dev.iris-ns'
pool:
vmImage: ubuntu-latest
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'manifest'
targetPath: '$(Pipeline.Workspace)/s/manifests'
- task: KubernetesManifest@1
inputs:
action: 'createSecret'
connectionType: 'kubernetesServiceConnection'
namespace: 'iris-ns'
secretType: 'dockerRegistry'
secretName: '$(acrsecret)'
dockerRegistryEndpoint: 'iris-south-acr'
- task: replacetokens@5
inputs:
rootDirectory: '$(Pipeline.Workspace)/s/manifests'
targetFiles: 'deployment.yml'
encoding: 'auto'
tokenPattern: 'custom'
tokenPrefix: '#'
tokenSuffix: '#'
writeBOM: true
actionOnMissing: 'warn'
keepToken: false
actionOnNoFiles: 'warn'
enableTransforms: false
enableRecursion: false
useLegacyPattern: false
enableTelemetry: true
- task: KubernetesManifest@1
inputs:
action: 'deploy'
connectionType: 'kubernetesServiceConnection'
namespace: 'iris-ns'
manifests: |
$(Pipeline.Workspace)/s/manifests/deployment.yml
$(Pipeline.Workspace)/s/manifests/service.yml
containers: '$(containerBaseUrl)/$(containerBaseRepo):$(tag)'