forked from Azure/azch-captureorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
77 lines (64 loc) · 2.38 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
variables:
- group: captureorder-variables # Variable Group containing 'mongoHost', 'mongoUser' and the secret 'mongoPassword'
- name: dockerRegistryServiceConnection
value: 'containerRegistryConnection' # make sure it matches the name you used in the service connection
- name: acrEndpoint
value: 'akschallengenos.azurecr.io' # replace with container registry endpoint
- name: tag
value: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build job
pool:
vmImage: ubuntu-latest
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: captureorder
dockerfile: '**/Dockerfile'
containerRegistry: $(dockerRegistryServiceConnection)
tags: $(tag)
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'manifests'
targetPath: 'manifests'
- stage: DeployDev
displayName: Deploy to dev stage
dependsOn: Build
variables:
- name: k8sNamespace # Kubernetes Namespace to deploy to. This variable is scoped to the DeployDev stage.
value: 'dev'
jobs:
- deployment: DeployDev
displayName: Deploy to dev job
pool:
vmImage: ubuntu-latest
environment: 'aksworkshop.dev' # name of the environment to target [env name.namespace]. This will pull in the Kubernetes service connection automatically
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@1
inputs:
artifactName: 'manifests'
downloadPath: '$(System.ArtifactsDirectory)/manifests'
- task: KubernetesManifest@0
displayName: Create secret for MongoDB
inputs:
action: createSecret
secretName: mongodb
secretType: generic
namespace: $(k8sNamespace)
secretArguments: --from-literal=mongoHost=$(mongoHost) --from-literal=mongoUser=$(mongoUser) --from-literal=mongoPassword=$(mongoPassword)
- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
action: deploy
namespace: $(k8sNamespace)
manifests: $(System.ArtifactsDirectory)/manifests/*
containers: '$(acrEndpoint)/captureorder:$(tag)'