Skip to content

Commit b61cf6c

Browse files
authored
ci: Fix condition for nightly deflaking runs (youtube#9171)
Bug: 461673387
1 parent 9769f6a commit b61cf6c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.github/actions/on_device_tests/action.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: On Device Test
22
description: Runs on-device tests.
33
inputs:
4+
nightly:
5+
description: "Indicates if this is a nightly job."
6+
required: true
47
test_targets_json:
58
description: "The test targets in a JSON array."
69
required: true
@@ -148,12 +151,13 @@ runs:
148151
path: ${{ env.test_output }}/*
149152
- name: Get Deflake Max Attempts
150153
id: deflake-attempts
154+
if: inputs.nightly == 'true'
151155
run: |
152156
MAX_ATTEMPTS=$(jq -r '.deflake_runs | tonumber? // 1' ${GITHUB_WORKSPACE}/.github/config/infra/deflake.json)
153157
echo "max_attempts=${MAX_ATTEMPTS}" >> $GITHUB_OUTPUT
154158
shell: bash
155159
- name: Run Nightly Deflake
156160
# Deflake workflow retries MAX_ATTEMPTS times. Pass the last to keep dashboard green.
157-
if: github.event_name == 'schedule' && github.run_attempt != steps.deflake-attempts.outputs.max_attempts
161+
if: inputs.nightly == 'true' && github.run_attempt != steps.deflake-attempts.outputs.max_attempts
158162
run: echo "::warning::Triggering deflaking run by failing." && exit 1
159163
shell: bash

.github/actions/on_host_tests/action.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: On Host Tests
22
description: Runs on-host tests.
33
inputs:
4+
nightly:
5+
description: "Indicates if this is a nightly job."
6+
required: true
47
test_artifacts_key:
58
description: "Artifact key used to store test artifacts."
69
required: true
@@ -112,13 +115,14 @@ runs:
112115
name: ${{ inputs.test_results_key }}
113116
path: ${{ env.results_dir }}/*
114117
- name: Get Deflake Max Attempts
118+
if: inputs.nightly == 'true'
115119
id: deflake-attempts
116120
run: |
117121
MAX_ATTEMPTS=$(jq -r '.deflake_runs | tonumber? // 1' ${GITHUB_WORKSPACE}/.github/config/infra/deflake.json)
118122
echo "max_attempts=${MAX_ATTEMPTS}" >> $GITHUB_OUTPUT
119123
shell: bash
120124
- name: Run Nightly Deflake
121125
# Deflake workflow retries MAX_ATTEMPTS times. Pass the last to keep dashboard green.
122-
if: github.event_name == 'schedule' && github.run_attempt != steps.deflake-attempts.outputs.max_attempts
126+
if: inputs.nightly == 'true' && github.run_attempt != steps.deflake-attempts.outputs.max_attempts
123127
run: echo "::warning::Triggering deflaking run by failing." && exit 1
124128
shell: bash

.github/workflows/main.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ jobs:
494494
if: ${{ fromJson(steps.test-target-json.outputs.test_targets_count) > 0 }}
495495
uses: ./.github/actions/on_device_tests
496496
with:
497+
nightly: ${{ inputs.nightly }}
497498
test_targets_json: ${{ steps.test-target-json.outputs.test_targets_json }}
498499
test_results_key: ${{ env.TEST_RESULTS_KEY }}
499500
gcs_results_path: gs://cobalt-unittest-storage/results/${{ matrix.name }}/${{ github.run_id }}/${{ github.run_attempt }}
@@ -694,6 +695,7 @@ jobs:
694695
if: ${{ fromJson(steps.test-target-json.outputs.test_targets_count) > 0 }}
695696
uses: ./.github/actions/on_host_tests
696697
with:
698+
nightly: ${{ inputs.nightly }}
697699
test_artifacts_key: ${{ env.TEST_ARTIFACTS_KEY }}
698700
test_results_key: ${{ env.TEST_RESULTS_KEY }}
699701
num_gtest_shards: ${{ needs.initialize.outputs.num_gtest_shards }}

0 commit comments

Comments
 (0)