Repository navigation
352 lines (305 loc) · 11.5 KB
/
Copy pathcheck.yml
File metadata and controls
352 lines (305 loc) · 11.5 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
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This reusable workflow executes a single check from `hadoop-ozone/dev-support/checks/`.
# Before and after the check, it performs various steps based on workflow inputs.
name: ci-check
on:
workflow_call:
inputs:
# REQUIRED
script:
type: string
description: "Test script to run from hadoop-ozone/dev-support/checks, without .sh extension"
required: true
sha:
type: string
description: "Commit SHA to test"
required: true
# OPTIONAL (ordered alphabetically)
checkout-fetch-depth:
type: number
description: "Fetch depth for checking out the repo (default: no history)"
default: 1
required: false
java-version:
type: string
description: "Java version to set up (default: none)"
default: ''
required: false
display-name:
type: string
description: "To be displayed instead of the script's name (default: none)"
default: ''
required: false
needs-npm-cache:
type: boolean
description: "Whether to restore NPM cache before run (default: no)"
default: false
required: false
needs-ozone-binary-tarball:
type: boolean
description: "Whether to download Ozone binary tarball created by build (default: no)"
default: false
required: false
needs-ozone-repo:
type: boolean
description: "Whether to download Ozone jars created by build (default: no)"
default: false
required: false
needs-ozone-source-tarball:
type: boolean
description: "Whether to download Ozone source tarball created by build (default: no)"
default: false
required: false
pre-script:
type: string
description: "Command to execute before the test script (default: none)"
default: ''
required: false
post-failure:
type: string
description: "Command to execute after the test script, if it failed (default: none)"
default: ''
required: false
post-success:
type: string
description: "Command to execute after the test script, if it succeeded (default: none)"
default: ''
required: false
ratis-args:
type: string
description: "Version overrides from custom Ratis build (default: none)"
default: ''
required: false
runner:
type: string
description: "GitHub Actions runner to use"
default: 'ubuntu-24.04'
required: false
script-args:
type: string
description: "Arguments for the test script, ratis-args are appended"
default: ''
required: false
split:
type: string
description: "Name of split for matrix jobs, used in display name and artifact name"
default: ''
required: false
timeout-minutes:
type: number
description: "Job timeout in minutes (default: 30)"
default: 30
required: false
with-coverage:
type: boolean
description: "The value of OZONE_WITH_COVERAGE to set"
default: true
required: false
secrets:
DEVELOCITY_ACCESS_KEY:
description: 'Token for submitting build scan to Develocity'
required: false
env:
HADOOP_IMAGE: ghcr.io/apache/hadoop
MAVEN_ARGS: --batch-mode --settings ${{ github.workspace }}/dev-support/ci/maven-settings.xml -Ddevelocity.user.config=${{ github.workspace }}/.mvn/develocity-asf.xml
MAVEN_OPTS: -Daether.connector.http.connectionMaxTtl=25 -Daether.connector.http.retryHandler.count=5 -Daether.connector.http.retryHandler.intervalMax=30000
MVNW_VERBOSE: true
OZONE_IMAGE: ghcr.io/apache/ozone
OZONE_RUNNER_IMAGE: ghcr.io/apache/ozone-runner
OZONE_VOLUME_OWNER: 1000
RANGER_IMAGE: ghcr.io/apache/ranger
SPARK_SQL_IMAGE: ghcr.io/apache/spark-docker/spark
DISPLAY_NAME: ${{ inputs.display-name }}
SCRIPT: ${{ inputs.script }}
SPLIT: ${{ inputs.split }}
permissions: { }
jobs:
check:
name: ${{ (inputs.split && format('{0} ({1})', (inputs.display-name || inputs.script), inputs.split)) || inputs.display-name || inputs.script }}
runs-on: ${{ inputs.runner }}
timeout-minutes: ${{ inputs.timeout-minutes }}
steps:
- name: Checkout project
if: ${{ !inputs.needs-ozone-source-tarball }}
uses: actions/checkout@v7
with:
persist-credentials: false
ref: ${{ inputs.sha }}
fetch-depth: ${{ inputs.checkout-fetch-depth }}
- name: Delete .git to omit commit SHA in build artifacts
if: ${{ !inputs.needs-ozone-source-tarball && inputs.checkout-fetch-depth == '1' }}
run: |
rm -fr .git
- name: Download Ozone source tarball
if: ${{ inputs.needs-ozone-source-tarball }}
uses: actions/download-artifact@v8
with:
name: ozone-src
- name: Extract source tarball
if: ${{ inputs.needs-ozone-source-tarball }}
run: |
tar --strip-components 1 -xzvf ozone*-src.tar.gz
- name: Cache for NPM dependencies
if: ${{ inputs.needs-npm-cache }}
uses: actions/cache@v6
with:
path: |
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Setup Java ${{ inputs.java-version }} with cache
if: ${{ inputs.java-version }}
uses: $/.github/actions/setup-java-with-cache
with:
java-version: ${{ inputs.java-version }}
- name: Download Ozone repo
id: download-ozone-repo
if: ${{ inputs.needs-ozone-repo }}
uses: actions/download-artifact@v8
with:
name: ozone-repo
path: |
~/.m2/repository/org/apache/ozone
- name: Download Ratis repo
if: ${{ inputs.ratis-args != '' }}
uses: actions/download-artifact@v8
with:
name: ratis-jars
path: |
~/.m2/repository/org/apache/ratis
- name: Download Ozone binary tarball
if: ${{ inputs.needs-ozone-binary-tarball }}
uses: actions/download-artifact@v8
with:
name: ozone-bin
- name: Extract binary tarball
if: ${{ inputs.needs-ozone-binary-tarball }}
run: |
mkdir -p hadoop-ozone/dist/target
tar xzvf ozone*.tar.gz -C hadoop-ozone/dist/target
rm ozone*.tar.gz
- name: Get versions
id: versions
# TODO remove hard-code in HDDS-17509
if: ${{ inputs.script == 'acceptance' }}
run: |
source hadoop-ozone/dev-support/checks/_lib.sh
HADOOP_VERSION=$(get_version hadoop)
echo "HADOOP_VERSION=$HADOOP_VERSION" >> $GITHUB_ENV
RANGER_VERSION=$(get_version ranger)
echo "RANGER_VERSION=$RANGER_VERSION" >> $GITHUB_ENV
- name: Restore Hadoop
id: restore-hadoop
# TODO reduce hard-code in HDDS-17509
if: ${{ inputs.script == 'acceptance' && contains(inputs.split, 'test-s3a.sh') }}
uses: apache/infrastructure-actions/stash/restore@restore/v1
with:
clean: true
path: ~/.cache/ozone
key: hadoop-${{ env.HADOOP_VERSION }}
- name: Restore Ranger
id: restore-ranger
# TODO reduce hard-code in HDDS-17509
if: ${{ inputs.script == 'acceptance' && (contains(inputs.split, 'test-ranger.sh') || contains(inputs.split, 'test-sts.sh')) }}
uses: apache/infrastructure-actions/stash/restore@restore/v1
with:
path: ~/.cache/ozone
key: ranger-${{ env.RANGER_VERSION }}
- name: Execute pre-test steps
if: ${{ inputs.pre-script }}
run: |
$COMMAND
env:
COMMAND: ${{ inputs.pre-script }}
- name: Execute tests
run: |
$COMMAND
env:
COMMAND: hadoop-ozone/dev-support/checks/${{ inputs.script }}.sh ${{ inputs.script-args }} ${{ inputs.ratis-args }}
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
OZONE_WITH_COVERAGE: ${{ inputs.with-coverage }}
- name: Execute post-failure steps
if: ${{ failure() && inputs.post-failure }}
run: |
$COMMAND
env:
COMMAND: ${{ inputs.post-failure }}
- name: Execute post-success steps
if: ${{ !failure() && inputs.post-success }}
run: |
$COMMAND
env:
COMMAND: ${{ inputs.post-success }}
- name: Summary of failures
if: ${{ failure() }}
run: |
if [[ -s "target/$SCRIPT/summary.md" ]]; then
cat target/$SCRIPT/summary.md >> $GITHUB_STEP_SUMMARY
fi
hadoop-ozone/dev-support/checks/_summary.sh target/$SCRIPT/summary.txt
- name: Calculate artifact name
id: artifact-name
if: ${{ !cancelled() }}
run: |
job="${DISPLAY_NAME:-$SCRIPT}"
split=""
if [[ -n "${SPLIT:-}" ]]; then
split=$(echo "-$SPLIT" | sed -e 's!/!-!g' -e 's/.sh$//')
fi
echo "ARTIFACT=${job}${split}" >> $GITHUB_ENV
- name: Archive build results
id: archive
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: ${{ env.ARTIFACT }}
# please keep path as a single item; move to that directory all files needed in the artifact
path: target/${{ inputs.script }}
continue-on-error: true
- name: Test summary
if: ${{ !cancelled() }}
continue-on-error: true
run: python3 dev-support/ci/junit_summary.py >> "$GITHUB_STEP_SUMMARY"
env:
JUNIT_REPORT_URL: ${{ steps.archive.outputs.artifact-url }}
# The following steps are hard-coded to be run only for 'build' check,
# to avoid the need for 3 more inputs.
- name: Store binaries for tests
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: ozone-bin
path: |
hadoop-ozone/dist/target/ozone-*.tar.gz
!hadoop-ozone/dist/target/ozone-*-src.tar.gz
retention-days: 1
- name: Store source tarball for compilation
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: ozone-src
path: |
hadoop-ozone/dist/target/ozone-*-src.tar.gz
retention-days: 1
- name: Store Maven repo for tests
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: ozone-repo
path: |
~/.m2/repository/org/apache/ozone
retention-days: 1