Skip to content

Commit 03cc8fa

Browse files
authored
HDDS-14171. Use workflow inputs in run command via environment variable (#9498)
1 parent 9665a20 commit 03cc8fa

3 files changed

Lines changed: 25 additions & 14 deletions

File tree

.github/workflows/check.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ env:
136136
OZONE_IMAGE: ghcr.io/apache/ozone
137137
OZONE_RUNNER_IMAGE: ghcr.io/apache/ozone-runner
138138
OZONE_VOLUME_OWNER: 1000
139+
SCRIPT: ${{ inputs.script }}
139140

140141
jobs:
141142
check:
@@ -222,32 +223,39 @@ jobs:
222223
- name: Execute pre-test steps
223224
if: ${{ inputs.pre-script }}
224225
run: |
225-
${{ inputs.pre-script }}
226+
$COMMAND
227+
env:
228+
COMMAND: ${{ inputs.pre-script }}
226229

227230
- name: Execute tests
228231
run: |
229-
hadoop-ozone/dev-support/checks/${{ inputs.script }}.sh ${{ inputs.script-args }} ${{ inputs.ratis-args }}
232+
$COMMAND
230233
env:
234+
COMMAND: hadoop-ozone/dev-support/checks/${{ inputs.script }}.sh ${{ inputs.script-args }} ${{ inputs.ratis-args }}
231235
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
232236
OZONE_WITH_COVERAGE: ${{ inputs.with-coverage }}
233237

234238
- name: Execute post-failure steps
235239
if: ${{ failure() && inputs.post-failure }}
236240
run: |
237-
${{ inputs.post-failure }}
241+
$COMMAND
242+
env:
243+
COMMAND: ${{ inputs.post-failure }}
238244

239245
- name: Execute post-success steps
240246
if: ${{ !failure() && inputs.post-success }}
241247
run: |
242-
${{ inputs.post-success }}
248+
$COMMAND
249+
env:
250+
COMMAND: ${{ inputs.post-success }}
243251

244252
- name: Summary of failures
245253
if: ${{ failure() }}
246254
run: |
247-
if [[ -s "target/${{ inputs.script }}/summary.md" ]]; then
248-
cat target/${{ inputs.script }}/summary.md >> $GITHUB_STEP_SUMMARY
255+
if [[ -s "target/$SCRIPT/summary.md" ]]; then
256+
cat target/$SCRIPT/summary.md >> $GITHUB_STEP_SUMMARY
249257
fi
250-
hadoop-ozone/dev-support/checks/_summary.sh target/${{ inputs.script }}/summary.txt
258+
hadoop-ozone/dev-support/checks/_summary.sh target/$SCRIPT/summary.txt
251259
252260
- name: Archive build results
253261
if: ${{ !cancelled() }}

.github/workflows/intermittent-test-check.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ env:
6565
RATIS_REPO: ${{ github.event.inputs.ratis-repo }}
6666
RATIS_VERSION: ${{ github.event.inputs.ratis-ref }}
6767
JAVA_VERSION: ${{ github.event.inputs.java-version }}
68+
SPLITS: ${{ github.event.inputs.splits }}
69+
SUBMODULE: ${{ github.event.inputs.submodule }}
6870
# Surefire 3.0.0-M4 is used because newer versions do not reliably kill the fork on timeout
6971
# SUREFIRE-1722, SUREFIRE-1815
7072
SUREFIRE_VERSION: 3.0.0-M4
@@ -82,7 +84,7 @@ jobs:
8284
name: Generate test matrix
8385
run: |
8486
splits=()
85-
for ((i = 1; i <= ${{ github.event.inputs.splits }}; i++)); do
87+
for ((i = 1; i <= $SPLITS; i++)); do
8688
splits+=("$i")
8789
done
8890
printf -v x "%s," "${splits[@]}"
@@ -130,15 +132,15 @@ jobs:
130132
- name: Build (most) of Ozone
131133
run: |
132134
args="-DskipRecon -DskipShade -Dmaven.javadoc.skip=true -Drocks_tools_native"
133-
if [[ "${{ github.event.inputs.ratis-ref }}" != "" ]]; then
135+
if [[ "$RATIS_VERSION" != "" ]]; then
134136
args="$args -Dratis.version=${{ needs.ratis.outputs.ratis-version }}"
135137
args="$args -Dratis.thirdparty.version=${{ needs.ratis.outputs.thirdparty-version }}"
136138
args="$args -Dio.grpc.version=${{ needs.ratis.outputs.grpc-version }}"
137139
args="$args -Dnetty.version=${{ needs.ratis.outputs.netty-version }}"
138140
args="$args -Dgrpc.protobuf-compile.version=${{ needs.ratis.outputs.protobuf-version }}"
139141
fi
140142
141-
args="$args -am -pl :${{ github.event.inputs.submodule }}"
143+
args="$args -am -pl :$SUBMODULE"
142144
143145
hadoop-ozone/dev-support/checks/build.sh $args
144146
- name: Store Maven repo for tests
@@ -199,16 +201,16 @@ jobs:
199201
export OZONE_REPO_CACHED=true
200202
fi
201203
202-
args="-DexcludedGroups=native|slow|unhealthy -DskipShade -Drocks_tools_native"
203-
if [[ "${{ github.event.inputs.ratis-ref }}" != "" ]]; then
204+
args="-DexcludedGroups=slow|unhealthy -DskipShade -Drocks_tools_native"
205+
if [[ "$RATIS_VERSION" != "" ]]; then
204206
args="$args -Dratis.version=${{ needs.ratis.outputs.ratis-version }}"
205207
args="$args -Dratis.thirdparty.version=${{ needs.ratis.outputs.thirdparty-version }}"
206208
args="$args -Dio.grpc.version=${{ needs.ratis.outputs.grpc-version }}"
207209
args="$args -Dnetty.version=${{ needs.ratis.outputs.netty-version }}"
208210
args="$args -Dgrpc.protobuf-compile.version=${{ needs.ratis.outputs.protobuf-version }}"
209211
fi
210212
211-
args="$args -pl :${{ github.event.inputs.submodule }}"
213+
args="$args -pl :$SUBMODULE"
212214
213215
if [ "$TEST_METHOD" = "ALL" ]; then
214216
echo "Running all tests from $TEST_CLASS"

.github/workflows/repeat-acceptance.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ env:
4848
OZONE_TEST_SELECTOR: ${{ github.event.inputs.test-filter }}
4949
FAIL_FAST: ${{ github.event.inputs.fail-fast }}
5050
JAVA_VERSION: 8
51+
SPLITS: ${{ github.event.inputs.splits }}
5152
run-name: ${{ github.event_name == 'workflow_dispatch' && format('{0}[{1}]-{2}', inputs.test-suite || inputs.test-filter, inputs.ref, inputs.splits) || '' }}
5253
jobs:
5354
prepare-job:
@@ -67,7 +68,7 @@ jobs:
6768
name: Generate test matrix
6869
run: |
6970
splits=()
70-
for ((i = 1; i <= ${{ github.event.inputs.splits }}; i++)); do
71+
for ((i = 1; i <= $SPLITS; i++)); do
7172
splits+=("$i")
7273
done
7374
printf -v x "%s," "${splits[@]}"

0 commit comments

Comments
 (0)