-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines-new.yml
69 lines (64 loc) · 2.41 KB
/
azure-pipelines-new.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
name: $(Build.BuildId)
trigger:
branches:
include:
- master
variables:
- group: 'AWS ECR-PUSH PROD'
stages:
- stage: CD
displayName: 'Build, test, deliver deployment artifacts'
jobs:
- job: CD
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .NET Core sdk'
inputs:
packageType: sdk
version: 3.1.100
installationPath: $(Agent.ToolsDirectory)/dotnet
- bash: |
set -eu -o pipefail
sudo pip install setuptools
sudo pip install awscli
chmod +x ./pipeline.sh
./pipeline.sh $(Build.BuildId) $(System.DefaultWorkingDirectory)
displayName: Pipeline Bash Script
env:
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
- bash: |
mkdir -p $(System.DefaultWorkingDirectory)/output/manifests
cat '$(System.DefaultWorkingDirectory)/k8s/deployment.yml' | envsubst > '$(System.DefaultWorkingDirectory)/output/manifests/deployment.yml'
cat '$(System.DefaultWorkingDirectory)/k8s/ingressroute.yml' | envsubst > '$(System.DefaultWorkingDirectory)/output/manifests/ingressroute.yml'
cat '$(System.DefaultWorkingDirectory)/k8s/service.yml' | envsubst > '$(System.DefaultWorkingDirectory)/output/manifests/service.yml'
displayName: Prepare k8s manifests
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: manifests"
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)/output/manifests'
ArtifactName: manifests
- stage: Deploy
dependsOn: CD
displayName: 'Deployments'
jobs:
- job: Production
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: none
- download: current
artifact: manifests
displayName: 'Download build artifacts'
- publish: '$(Pipeline.Workspace)/manifests/'
artifact: deployed-manifests
displayName: 'Publish manifests'
- task: Kubernetes@1
displayName: kubectl apply
inputs:
connectionType: Kubernetes Service Connection
kubernetesServiceEndpoint: Kubernetes-Hellman-selfservice-deploy
cwd: '$(Pipeline.Workspace)/manifests/'
command: apply
arguments: -f .