-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1-thebank-app-pipeline.yml
70 lines (66 loc) · 2.22 KB
/
1-thebank-app-pipeline.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
# create a unique name based on your project requirements
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
trigger: none
resources:
- repo: self
# global variables
variables:
dockerRegistryServiceConnection: 'registry-conn'
imageRepository: 'thebank'
containerRegistry: 'acrdwe001.azurecr.io'
dockerfilePath: '**/Dockerfile'
tag: '$(Build.BuildId)'
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:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'manifests'
targetPath: 'manifests'
- stage: Release
displayName: Release stage
jobs:
- deployment: DeployToAKS
pool:
vmImage: $(vmImageName)
environment: prod
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@1
displayName: Download pipeline artifacts
inputs:
artifactName: 'manifests'
downloadPath: '$(System.ArtifactsDirectory)/manifests'
- task: Kubernetes@1
displayName: Create Kubernetes NS
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: 'cluster-conn'
command: 'apply'
arguments: '-f $(System.ArtifactsDirectory)/manifests/thebank-ns.yml'
- task: KubernetesManifest@0
displayName: Deploy Kubernetes deployment manifest
inputs:
action: 'deploy'
kubernetesServiceConnection: 'cluster-conn'
namespace: 'thebank'
manifests: '$(System.ArtifactsDirectory)/manifests/thebank.yml'
containers: '$(containerRegistry)/$(imageRepository):$(tag)'