-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
70 lines (67 loc) · 1.86 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
trigger:
branches:
include:
- main
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
acrsecret: mysecret
stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool: 'Azure Pipelines'
steps:
- task: Docker@2
displayName: Build an image
inputs:
containerRegistry: 'acr-svc'
repository: 'sank64cr'
command: 'buildAndPush'
Dockerfile: '**/Dockerfile'
tags: |
$(tag)
latest
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)/s/k8s'
artifact: 'manifests'
publishLocation: 'pipeline'
- stage: Deploy
displayName: Deploy to AKS
dependsOn: Build
jobs:
- job: Deploy
displayName: Deploy
pool: 'Azure Pipelines'
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'manifests'
targetPath: '$(Pipeline.Workspace)/manifests'
- task: KubernetesManifest@1
inputs:
action: 'createSecret'
connectionType: 'kubernetesServiceConnection'
kubernetesServiceConnection: 'myAKSCLuster'
namespace: 'default'
secretType: 'dockerRegistry'
secretName: '$(acrsecret)'
dockerRegistryEndpoint: 'acr-svc'
- task: KubernetesManifest@1
inputs:
action: 'deploy'
connectionType: 'kubernetesServiceConnection'
kubernetesServiceConnection: 'myAKSCLuster'
namespace: 'default'
manifests: |
$(Pipeline.Workspace)/manifests/pvc.yml
$(Pipeline.Workspace)/manifests/env-config.yml
$(Pipeline.Workspace)/manifests/db-microservice.yml
$(Pipeline.Workspace)/manifests/api-microservice.yml
$(Pipeline.Workspace)/manifests/api-lb.yml
$(Pipeline.Workspace)/manifests/adminer.yml