Skip to content

Commit 1972a3c

Browse files
Fix failing smoke tests for CICD (#1257)
This pull request updates the smoke test GitHub Actions workflow to improve runner selection and environment setup, as well as to ensure more robust artifact uploading. The most important changes are grouped below: **Runner selection and environment setup:** * Added a step to extract and format a unique runner ID from the `RUNNER_NAME` environment variable, and exposed it as a workflow output (`runner-id`) for downstream jobs. * Changed the runner specification for the `validation-run-tests` job to use the dynamically determined `runner-id` output from the previous job, enabling more flexible and targeted runner selection. * Updated the replacement of the `MTL_PATH_PLACEHOLDER` in the test configuration file to use the current workspace path instead of a secret, simplifying environment setup. **Artifact upload robustness:** * Modified the report upload step to always run, regardless of previous step outcomes, ensuring test reports are uploaded even if earlier steps fail.
1 parent 6c12179 commit 1972a3c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/smoke-tests.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,21 @@ jobs:
2121
timeout-minutes: 60
2222
outputs:
2323
pipenv-activate: ${{ steps.pipenv-install.outputs.VIRTUAL_ENV }}
24+
runner-id: ${{ steps.get-runner-id.outputs.runner_id }}
2425
steps:
2526
- name: 'preparation: Harden Runner'
2627
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
2728
with:
2829
egress-policy: audit
30+
- name: 'preparation: Get Runner ID'
31+
id: get-runner-id
32+
run: |
33+
# Extract runner number from RUNNER_NAME (e.g., "cicd-1" -> "1")
34+
RUNNER_NUMBER=$(echo "$RUNNER_NAME" | grep -o '[0-9]\+$' || echo "1")
35+
# Format as runner-X
36+
RUNNER_ID="runner-${RUNNER_NUMBER}"
37+
echo "runner_id=$RUNNER_ID" >> "$GITHUB_OUTPUT"
38+
echo "Using runner ID: $RUNNER_ID (from runner name: $RUNNER_NAME)"
2939
- name: 'preparation: Restore valid repository owner and print env'
3040
if: always()
3141
run: |
@@ -126,14 +136,14 @@ jobs:
126136
echo "VIRTUAL_ENV=$PWD/venv/bin/activate" >> "$GITHUB_ENV"
127137
validation-run-tests:
128138
needs: [validation-build-mtl]
129-
runs-on: [Linux, self-hosted, DPDK]
139+
runs-on: [self-hosted, "${{ needs.validation-build-mtl.outputs.runner-id }}"]
130140
timeout-minutes: 720
131141
env:
132142
PYTEST_RETRIES: '3'
133143
steps:
134144
- name: Replace secrets in example config files
135145
run: |
136-
sed -i "s+MTL_PATH_PLACEHOLDER+${{ secrets.BARE_METAL_MTL_PATH }}+" tests/validation/configs/test_config.yaml
146+
sed -i "s+MTL_PATH_PLACEHOLDER+${{ github.workspace }}+" tests/validation/configs/test_config.yaml
137147
sed -i "s/IP_ADDRESS_PLACEHOLDER/${{ secrets.BARE_METAL_IP_ADDRESS }}/" tests/validation/configs/topology_config.yaml
138148
sed -i "s/SSH_PORT_PLACEHOLDER/${{ secrets.BARE_METAL_SSH_PORT }}/" tests/validation/configs/topology_config.yaml
139149
sed -i "s/USERNAME_PLACEHOLDER/${{ secrets.BARE_METAL_USERNAME }}/" tests/validation/configs/topology_config.yaml
@@ -167,6 +177,7 @@ jobs:
167177
run: |
168178
sudo tests/validation/venv/bin/python3 -m pytest --topology_config=tests/validation/configs/topology_config.yaml --test_config=tests/validation/configs/test_config.yaml -m smoke --template=html/index.html --report=report.html
169179
- name: "upload report"
180+
if: always()
170181
id: upload-report
171182
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
172183
with:

0 commit comments

Comments
 (0)