-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines-1.yml
76 lines (71 loc) · 2.26 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
# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- main
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '1c36ab36-a030-4d20-952a-dae79376a1ef'
imageRepository: 'bitcoinvalueapp'
containerRegistry: 'bitcoinvalue.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/service-a/dockerfile'
tag: '$(Build.BuildId)'
# Agent VM image name
vmImageName: 'ubuntu-latest'
stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
containerRegistry: 'connection to ACR'
repository: '$(imageRepository)'
command: 'buildAndPush'
Dockerfile: '$(Build.SourcesDirectory)/service-a/dockerfile'
tags: |
$(tag)
latest
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)/s/k8s/service-a-deployment.yml'
artifact: 'manifests-a'
publishLocation: 'pipeline'
- stage: Deploy
displayName: Deploy to Dev
dependsOn: Build
variables:
acrsecret: bitcoinvalueacrauth
jobs:
- job: Deploy
displayName: Deploy to AKS
pool:
vmImage : ubuntu-latest
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'manifests-a'
targetPath: '$(Pipeline.Workspace)/manifests-a'
- task: KubernetesManifest@1
inputs:
action: 'createSecret'
connectionType: 'kubernetesServiceConnection'
kubernetesServiceConnection: 'BitcoinValueCluster-btc'
secretType: 'dockerRegistry'
secretName: '$(acrsecret)'
dockerRegistryEndpoint: 'connection to ACR'
- task: KubernetesManifest@1
inputs:
action: 'deploy'
connectionType: 'kubernetesServiceConnection'
kubernetesServiceConnection: 'BitcoinValueCluster-btc'
namespace: 'btc'
manifests: '$(Pipeline.Workspace)/s/k8s/service-a-deployment.yml'