forked from sscarduzio/elasticsearch-readonlyrest-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
254 lines (232 loc) · 7.17 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
variables:
ssh_file: '~/.ssh/gh_deploy_key.priv'
isMaster: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
isDevelop: $[eq(variables['Build.SourceBranch'], 'refs/heads/develop')]
isPullRequest: $[eq(variables['Build.Reason'], 'PullRequest')]
trigger:
batch: false
branches:
include:
- master
- develop
tags:
exclude:
- '*'
paths:
include:
- '*'
exclude:
- 'docs/*'
- '*.md'
- '*/*/*.md'
pool:
vmImage: 'ubuntu-20.04'
stages:
- stage: CVE
dependsOn: [] # run in parallel
jobs:
- job:
steps:
- checkout: self
fetchDepth: 1
clean: false
persistCredentials: true
- script: |
echo ">> ALL BUILD* VARIABLES " && export | grep BUILD
echo "[CVE] executing ROR_TASK=$ROR_TASK"
bin/build.sh
continueOnError: true
env:
ROR_TASK: cve_check
- stage: TEST
jobs:
- job:
steps:
- checkout: self
fetchDepth: 1
clean: false
persistCredentials: true
- script: |
echo "[TEST] executing ROR_TASK = $ROR_TASK"
bin/build.sh
- task: PublishTestResults@2
condition: failed()
inputs:
testRunTitle: "$(ROR_TASK) results"
testResultsFiles: "**/TEST*xml"
mergeTestResults: true
strategy:
maxParallel: 99
matrix:
LICENSE:
ROR_TASK: license
UNIT:
ROR_TASK: core_tests
IT_PROXY:
ROR_TASK: integration_proxy
IT_es716x:
ROR_TASK: integration_es716x
IT_es714x:
ROR_TASK: integration_es714x
IT_es711x:
ROR_TASK: integration_es711x
IT_es710x:
ROR_TASK: integration_es710x
IT_es79x:
ROR_TASK: integration_es79x
IT_es78x:
ROR_TASK: integration_es78x
IT_es77x:
ROR_TASK: integration_es77x
IT_es74x:
ROR_TASK: integration_es74x
IT_es73x:
ROR_TASK: integration_es73x
IT_es72x:
ROR_TASK: integration_es72x
IT_es70x:
ROR_TASK: integration_es70x
IT_es67x:
ROR_TASK: integration_es67x
IT_es66x:
ROR_TASK: integration_es66x
IT_es65x:
ROR_TASK: integration_es65x
IT_es63x:
ROR_TASK: integration_es63x
IT_es62x:
ROR_TASK: integration_es62x
IT_es61x:
ROR_TASK: integration_es61x
IT_es60x:
ROR_TASK: integration_es60x
IT_es55x:
ROR_TASK: integration_es55x
- stage: BLD_TEST
dependsOn:
- TEST
condition: and(succeeded('TEST'), eq(variables.isPullRequest, true))
jobs:
- job:
steps:
- checkout: self
fetchDepth: 1
clean: false
- script: |
set -e
echo "[BLD_TEST] executing ROR_TASK = $ROR_TASK"
echo ">>> ($ROR_TASK) Creating deliverables" && bin/build.sh
strategy:
maxParallel: 99
matrix:
PKG_es7xx:
ROR_TASK: package_es7xx
PKG_es6xx:
ROR_TASK: package_es6xx
PKG_es5xx:
ROR_TASK: package_es5xx
- stage: S3_UP
dependsOn:
- TEST
condition: and(succeeded('TEST'), or(eq(variables.isDevelop, true), eq(variables.isMaster, true)))
jobs:
- job:
steps:
- checkout: self
fetchDepth: 1
clean: false
persistCredentials: true
- task: DownloadSecureFile@1
name: ghKey
displayName: 'Download gh_deploy_key.priv secret file'
inputs:
secureFile: 'gh_deploy_key.priv'
- script: |
set -e
echo Installing $(ghKey.secureFilePath) to directory...
mkdir -p ~/.ssh && chmod 0700 ~/.ssh
touch $(ssh_file)
sudo cat $(ghKey.secureFilePath) > $(ssh_file)
echo "$(ssh_file) MD5SUSM `md5sum $(ssh_file)`"
sudo chmod 600 $(ssh_file) && sudo printf "%s\n" \
"Host github.com" \
" IdentityFile $(ssh_file)" \
" LogLevel ERROR" >> ~/.ssh/config
ls -ltra ~/.ssh
- script: |
set -e
# Translate back env vars to avoid cyclical reference :/
export aws_access_key_id=$var_aws_access_key_id
export aws_secret_access_key=$var_aws_secret_access_key
echo ">> ALL VARIABLES NAMES " && export | awk -F= '{print $1}'
echo ">> ALL BUILD* VARIABLES " && export | grep BUILD
echo "[S3_UP] executing ROR_TASK = $ROR_TASK"
chown -R $USER ~/.ssh
echo ">>>>>>>>> content of .ssh/" && ls -ltra ~/.ssh
echo ">>> ($ROR_TASK) Creating deliverables to be published" && bin/build.sh
echo ">>> ($ROR_TASK) Tag and upload to S3" && ci/ci-deploy.sh
env:
var_aws_access_key_id: $(aws_access_key_id)
var_aws_secret_access_key: $(aws_secret_access_key)
strategy:
maxParallel: 99
matrix:
PKG_es7xx:
ROR_TASK: package_es7xx
PKG_es6xx:
ROR_TASK: package_es6xx
PKG_es5xx:
ROR_TASK: package_es5xx
- stage: MVN_PUB
dependsOn:
- TEST
condition: and(succeeded('TEST'), eq(variables.isMaster, true))
jobs:
- job:
steps:
- checkout: self
fetchDepth: 1
clean: false
persistCredentials: true
# Populate the global variable mvn_status for later
- script: |
PLUGIN_VER=$(awk -F= '$1=="pluginVersion" {print $2}' gradle.properties)
URL="https://oss.sonatype.org/service/local/repositories/releases/content/tech/beshu/ror/audit_2.12/$PLUGIN_VER/"
echo "Maven artifact URL to check: $URL"
MVN_STATUS=$(curl --write-out '%{http_code}' --output /dev/null "$URL")
echo "##vso[task.setvariable variable=mvn_status]$MVN_STATUS"
- script: |
echo ">> MVN_STATUS WAS 200. Artifact already present, no need to proceed further with Maven publishing."
condition: eq(200, variables.mvn_status)
- script: |
echo ">> MVN_STATUS WAS 404. Artifact not present in Maven repository, proceeding with publishing."
condition: eq(404, variables.mvn_status)
- task: DownloadSecureFile@1
name: pgp
displayName: 'Download secret.pgp secret file'
inputs:
secureFile: 'secret.pgp'
- script: |
echo Installing $(pgp.secureFilePath) to directory...
sudo chown root:root $(pgp.secureFilePath)
sudo chmod a+r $(pgp.secureFilePath)
mkdir .travis
sudo ln -s -t .travis/ $(pgp.secureFilePath)
echo "secret.pgp MD5SUSM `md5sum .travis/secret.pgp`"
condition: eq(404, variables.mvn_status)
- script: |
echo "[MVN_PUB] executing ROR_TASK=$ROR_TASK"
export MAVEN_REPO_PASSWORD=$VAR_MAVEN_REPO_PASSWORD
export MAVEN_REPO_USER=$VAR_MAVEN_REPO_USER
export MAVEN_STAGING_PROFILE_ID=$VAR_MAVEN_STAGING_PROFILE_ID
export GPG_KEY_ID=$VAR_GPG_KEY_ID
export GPG_PASSPHRASE=$VAR_GPG_PASSPHRASE
echo ">>> ($ROR_TASK) Publishing artifacts" && bin/build.sh
env:
ROR_TASK: publish_artifacts
VAR_MAVEN_REPO_PASSWORD: $(MAVEN_REPO_PASSWORD)
VAR_MAVEN_REPO_USER: $(MAVEN_REPO_USER)
VAR_MAVEN_STAGING_PROFILE_ID: $(MAVEN_STAGING_PROFILE_ID)
VAR_GPG_PASSPHRASE: $(GPG_PASSPHRASE)
VAR_GPG_KEY_ID: $(GPG_KEY_ID)
condition: eq(404, variables.mvn_status)