This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-deploy-pipeline.yaml
90 lines (78 loc) · 2.89 KB
/
azure-deploy-pipeline.yaml
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
---
# YAML reference:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema%2Cparameter-schema
#
# General info:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/environments?view=azure-devops
#
# Kube resource/environment references:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/environments-kubernetes?view=azure-devops
#
# Challenges:
# https://github.com/MicrosoftDocs/azure-devops-docs/issues/3702
# - Possible path: https://github.com/microsoft/azure-pipelines-yaml/blob/master/design/runtime-parameters.md
#
# - Multiple environment sets (prod-a, prod-b, stage-a, stage-b, ...)
# Document as variable groups not easy (see 3702 issue above).
# Runtime might fix with template files...
#
# - Kube credentials could be managed externally possibly, environment
# definitions don't actually need to have any content and can just be place
# holders.
#
# Environments:
# - Top level environments dont really _do_ anything.
# - They can have approvals tied to them
# - Can have business hour and branch based filters for automatic safety checks
# - Can have 'exlusive lock' to prevent overlapping deploys.
parameters:
- name: deployEnvironment
displayName: Deploy Environment Name
type: string
values:
- emarcotte-dev
- emarcotte-stage
# This file isnt evaluated procedurally, but the parameters replacement is done
# _before_ other replacements, so it makes sense to list parameters and
# variable templates at the top to imply that they come first. Pay special
# attention to the symbols used to extract variables, they influence when the
# replacement happens.
variables:
- template: ./azure-variables/${{ parameters.deployEnvironment }}.yaml
# Pull in the app source code repository as well as the 'self' repo
# https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops
resources:
repositories:
- repository: AppRepo
endpoint: emarcotte-service-connection
name: emarcotte/deployment-app-1
type: github
ref: refs/tags/$(appVersion)
# No triggers for now
trigger: none
pr: none
stages:
- stage: Deploy
jobs:
- deployment: deployToEnvironment
displayName: deploy application to dev
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/release'))
pool:
vmImage: Ubuntu-latest
# This is just basic grouping of resources, doesn't _really_ afford any
# capabilities.
environment: $(k8sEnvironment)
strategy:
runOnce:
deploy:
steps:
- checkout: self
- checkout: AppRepo
# Fake out a helm task for now.
- task: HelmDeploy@0
displayName: helm run
inputs:
connectionType: Kubernetes Service Connection
kubernetesServiceEndpoint: $(k8sServiceConnection)
namespace: $(k8sNamespace)
command: ls