-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path06-azure-kubernetes-ci-cd.yml
60 lines (54 loc) · 1.43 KB
/
06-azure-kubernetes-ci-cd.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
# Stage 1
# Build Docker Image
# Publish K8S Files
trigger:
- main
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Docker@2
inputs:
containerRegistry: 'manusysadmin@docker-hub'
repository: 'manusysadmin/currency-exchange-devops'
command: 'buildAndPush'
Dockerfile: '**/Dockerfile'
tags: '$(tag)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'manifests'
publishLocation: 'Container'
- stage: Deploy
displayName: Deploy image
jobs:
- job: Deploy
displayName: Deploy
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'manifests'
itemPattern: '**/*.yaml'
targetPath: '$(System.ArtifactsDirectory)'
- task: KubernetesManifest@0
inputs:
action: 'deploy'
kubernetesServiceConnection: 'azure-kubernetes-cluster-connection'
namespace: 'default'
manifests: '$(System.ArtifactsDirectory)/configuration/kubernetes/deployment.yaml'
containers: 'manusysadmin/currency-exchange-devops:$(tag)'
# Stage 2
# Download K8S Files
# Deploy to K8S Cluster with Docker Image