-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
84 lines (78 loc) · 2.55 KB
/
azure-pipelines.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
77
78
79
80
81
82
83
trigger:
- 'main'
variables:
buildConfiguration: 'Release'
leaderboardRepository: 'leaderboard'
webRepository: 'web'
tag: '$(Build.BuildId)'
imagePullSecret: 'secret'
stages:
- stage: 'Build'
displayName: 'Build and push'
jobs:
- job: 'Build'
displayName: 'Build job'
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: Docker@2
displayName: 'Build and push the image to container registry'
inputs:
command: buildAndPush
buildContext: $(Build.Repository.LocalPath)
repository: $(webRepository)
dockerfile: '$(Build.SourcesDirectory)/Tailspin.SpaceGame.Web/Dockerfile'
containerRegistry: 'Container Registry Connection'
tags: |
$(tag)
- task: Docker@2
displayName: 'Build and push the leaderboard image to container registry'
inputs:
command: buildAndPush
buildContext: $(Build.Repository.LocalPath)
repository: $(leaderboardRepository)
Dockerfile: '$(Build.SourcesDirectory)/Tailspin.SpaceGame.LeaderboardContainer/Dockerfile'
containerRegistry: 'Container Registry Connection'
tags: |
$(tag)
- publish: '$(Build.SourcesDirectory)/manifests'
artifact: manifests
- stage: 'Deploy'
displayName: 'Deploy the containers'
dependsOn: Build
jobs:
- deployment: Deploy
displayName: Deploy
pool:
vmImage: 'ubuntu-20.04'
environment: 'spike.default'
variables:
- group: Release
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: manifests
- task: KubernetesManifest@0
displayName: Create imagePullSecret
inputs:
action: createSecret
secretName: $(imagePullSecret)
dockerRegistryEndpoint: 'Container Registry Connection'
kubernetesServiceConnection: 'Kubernetes Cluster Connection'
namespace: 'default'
- task: KubernetesManifest@0
displayName: 'Deploy to Kubernetes cluster'
inputs:
action: deploy
kubernetesServiceConnection: 'Kubernetes Cluster Connection'
namespace: 'default'
manifests: |
$(Pipeline.Workspace)/manifests/deployment.yml
$(Pipeline.Workspace)/manifests/service.yml
imagePullSecrets: |
$(imagePullSecret)
containers: |
$(RegistryName)/$(webRepository):$(tag)
$(RegistryName)/$(leaderboardRepository):$(tag)