-
Notifications
You must be signed in to change notification settings - Fork 26
/
azure-pipelines.yml
118 lines (98 loc) · 3.08 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Need to periodically build in order to update Azure service tags
# for API Management IP restriction for in vs. out of datacenter
schedules:
- cron: "0 14 * * Tue"
displayName: Weekly master build, Tuesday at 2PM UTC, 10AM Eastern
branches:
include:
- master
always: true
trigger:
branches:
include:
- master
tags:
include:
- "*"
pool:
vmImage: "ubuntu-18.04"
variables:
CI: 1
subscriptionId: a84a690d-585b-4c7c-80d9-851a48af5a50
pcAcr: pccomponents
pcTestAcr: pccomponentstest
isMaster: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
isTag: $[startsWith(variables['Build.SourceBranch'], 'refs/tags/')]
mqeImageName: pc-query-stacapi
dqeImageName: pc-query-dataapi
migrationsImageName: pc-query-stacapi-migrations
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
imageTag: latest
${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
imageTag: $[variables['Build.SourceBranchName']]
deployEnvironment: staging
jobs:
- job: BuildAndTest
steps:
- script: |
scripts/cibuild
displayName: "Run cibuild"
- job: Publish
steps:
- script: |
export BUILD_ONLY=1
scripts/cibuild
displayName: "Build containers"
# Publish to PC Test ACR
- task: Docker@2
displayName: Login to PC Test ACR
inputs:
command: login
containerRegistry: pccomponentstest
- task: AzureCLI@2
env:
HELM_EXPERIMENTAL_OCI: 1
inputs:
azureSubscription: 'Planetary Computer Test'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
scripts/cipublish --acr $(pcTestAcr) --tag $(imageTag)
displayName: "Publish to PC Test ACR"
# Publish to PC ACR
- task: Docker@2
displayName: Login to PC ACR
inputs:
command: login
containerRegistry: pccomponents
- task: AzureCLI@2
env:
HELM_EXPERIMENTAL_OCI: 1
inputs:
azureSubscription: 'pccomponents-arm'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
scripts/cipublish --acr $(pcAcr) --tag $(imageTag)
displayName: "Publish to PC ACR"
dependsOn: BuildAndTest
condition: or(eq(variables.isMaster, true), eq(variables.isTag, true))
- job: Deploy
steps:
- task: AzureCLI@2
displayName: "Run deploy script"
inputs:
scriptType: bash
scriptLocation: inlineScript
azureSubscription: 'Planetary Computer Test'
addSpnToEnvironment: true
inlineScript: |
export subscriptionId=$(subscriptionId)
export MQE_IMAGE_NAME=$(mqeImageName)
export DQE_IMAGE_NAME=$(dqeImageName)
export MIGRATIONS_IMAGE_NAME=$(migrationsImageName)
export IMAGE_TAG=$(imageTag)
export ENVIRONMENT=$(deployEnvironment)
scripts/cideploy
dependsOn: Publish
condition: eq(variables.isMaster, true)