-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
142 lines (124 loc) · 5.09 KB
/
azure-pipelines.yml
File metadata and controls
142 lines (124 loc) · 5.09 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
trigger:
branches:
include:
- main
pr:
branches:
include:
- main
variables:
python_version: '3.12'
terraform_version: '1.14.8'
cluster_dir: 'clusters/us-east-1/qa/aroclassic210'
artifact_dir: '$(Build.ArtifactStagingDirectory)/aroclassic210'
terraform_apply: 'false'
azure_service_connection: 'your-service-connection'
stages:
- stage: Validate
displayName: Validate And Plan
jobs:
- job: validate_plan
displayName: Validate cluster stack
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
fetchDepth: 0
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python_version)'
- task: TerraformInstaller@1
inputs:
terraformVersion: '$(terraform_version)'
- script: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y jq ripgrep
displayName: Install jq and ripgrep
- script: |
set -euo pipefail
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
displayName: Install Helm
- script: |
set -euo pipefail
curl -fsSL https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz -o /tmp/openshift-client-linux.tar.gz
tar -xzf /tmp/openshift-client-linux.tar.gz -C /tmp oc
sudo install /tmp/oc /usr/local/bin/oc
oc version --client
displayName: Install OpenShift CLI
- task: AzureCLI@2
displayName: Validate and plan cluster stack
inputs:
azureSubscription: $(azure_service_connection)
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
set -euo pipefail
chmod +x scripts/check_required_ci_tools.sh scripts/run_cluster_stack.sh scripts/run_cluster_stack_bastion.sh
scripts/check_required_ci_tools.sh bash git jq python3 terraform helm rg oc az
scripts/run_cluster_stack.sh \
--cluster-dir "$(cluster_dir)" \
--artifact-dir "$(artifact_dir)" \
--mode plan
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(artifact_dir)'
artifact: 'cluster-artifacts'
publishLocation: pipeline
- stage: Apply
displayName: Apply
dependsOn: Validate
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['terraform_apply'], 'true'))
jobs:
- deployment: apply_cluster
displayName: Apply cluster stack
environment: aro-classic-apply
strategy:
runOnce:
deploy:
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
fetchDepth: 0
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python_version)'
- task: TerraformInstaller@1
inputs:
terraformVersion: '$(terraform_version)'
- script: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y jq ripgrep
displayName: Install jq and ripgrep
- script: |
set -euo pipefail
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
displayName: Install Helm
- script: |
set -euo pipefail
curl -fsSL https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz -o /tmp/openshift-client-linux.tar.gz
tar -xzf /tmp/openshift-client-linux.tar.gz -C /tmp oc
sudo install /tmp/oc /usr/local/bin/oc
oc version --client
displayName: Install OpenShift CLI
- task: AzureCLI@2
displayName: Apply cluster stack
inputs:
azureSubscription: $(azure_service_connection)
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
set -euo pipefail
chmod +x scripts/check_required_ci_tools.sh scripts/run_cluster_stack.sh scripts/run_cluster_stack_bastion.sh
scripts/check_required_ci_tools.sh bash git jq python3 terraform helm rg oc az
scripts/run_cluster_stack.sh \
--cluster-dir "$(cluster_dir)" \
--artifact-dir "$(artifact_dir)" \
--mode apply
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(artifact_dir)'
artifact: 'cluster-artifacts-apply'
publishLocation: pipeline