-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
90 lines (77 loc) · 2.51 KB
/
azure-pipelines.yml
File metadata and controls
90 lines (77 loc) · 2.51 KB
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
name: $(Major).$(Minor).$(Rev:r)
trigger:
- main
pool: Default
variables:
- name: Application
value: 'cool_counters'
- name: Major
value: '0'
- name: Minor
value: '0'
- group: AWS-ECR-Variables
stages:
- stage: CI
jobs:
- job:
steps:
- bash: |
docker build -t $(AWS_ECR_REPOSITORY):$(Build.BuildNumber) $(Build.SourcesDirectory)/$(Application)
displayName: 'Build docker image'
- task: ECRPushImage@1
displayName: Push image to AWS ECR
inputs:
awsCredentials: $(AWS_CREDENTIALS)
regionName: $(AWS_REGION)
imageSource: 'imagename'
sourceImageName: $(AWS_ECR_REPOSITORY)
sourceImageTag: $(Build.BuildNumber)
pushTag: $(Build.BuildNumber)
repositoryName: $(AWS_ECR_REPOSITORY)
logRequest: true
logResponse:
- stage: CD
pool: Default
jobs:
- deployment:
environment: dev
displayName: Deployment
strategy:
runOnce:
deploy:
steps:
- task: replacetokens@4
displayName: Replace tokens in values.yaml
inputs:
rootDirectory: '$(Build.SourcesDirectory)/deploy_resources/k8s-deployment-app'
targetFiles: 'values.yaml'
tokenPattern: custom
actionOnNoFiles: fail
tokenPrefix: '__'
tokenSuffix: '__'
- task: replacetokens@4
displayName: Replace tokens in Chart.yaml
inputs:
rootDirectory: '$(Build.SourcesDirectory)/deploy_resources/k8s-deployment-app'
targetFiles: 'Chart.yaml'
tokenPattern: custom
actionOnNoFiles: fail
tokenPrefix: '__'
tokenSuffix: '__'
- task: HelmDeploy@0
displayName: Package Helm Chart for $(Application)
inputs:
command: 'package'
chartPath: '$(Build.SourcesDirectory)/deploy_resources/k8s-deployment-app'
- task: HelmDeploy@0
continueOnError: true
displayName: Deploy to cluster
inputs:
namespace: 'python-app'
command: 'upgrade'
connectionType: Kubernetes Service Connection
kubernetesCluster: 'devops-catalog'
KubernetesServiceEndpoint: 'dev-python-app-1644715730033'
releaseName: 'counter'
chartType: filepath
chartPath: '$(Build.StagingDirectory)/k8s-deployment-app-$(Build.BuildNumber).tgz'