diff --git a/.github/workflows/release-rpm-smoke.yml b/.github/workflows/release-rpm-smoke.yml index 3486333a2b..53bab7ff7e 100644 --- a/.github/workflows/release-rpm-smoke.yml +++ b/.github/workflows/release-rpm-smoke.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: run-id: - description: Release workflow run containing the RPM artifacts (empty selects latest release branch run) + description: Release run containing both RPM artifacts (empty selects the latest available pair) type: string default: "" pull_request: @@ -17,7 +17,33 @@ permissions: actions: read jobs: + source: + runs-on: ubuntu-24.04 + timeout-minutes: 5 + outputs: + run-id: ${{ steps.source.outputs.run-id }} + steps: + - id: source + env: + GH_TOKEN: ${{ github.token }} + RUN_ID: ${{ inputs.run-id }} + run: | + candidates="$RUN_ID" + if [ -z "$candidates" ]; then + candidates=$(gh run list --repo "$GITHUB_REPOSITORY" --workflow release.yml --branch release --limit 10 --json databaseId --jq '.[].databaseId') + fi + for candidate in $candidates; do + [[ "$candidate" =~ ^[0-9]+$ ]] + names=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$candidate/artifacts?per_page=100" --jq '.artifacts[] | select(.expired == false) | .name') + if grep -Fxq release-linux-x86_64 <<< "$names" && grep -Fxq release-linux-aarch64 <<< "$names"; then + printf 'run-id=%s\n' "$candidate" >> "$GITHUB_OUTPUT" + exit 0 + fi + done + echo '::error::No release run has both Linux package artifacts available' + exit 1 smoke: + needs: source timeout-minutes: 25 strategy: fail-fast: false @@ -34,12 +60,9 @@ jobs: - name: Download the release packages env: GH_TOKEN: ${{ github.token }} - RUN_ID: ${{ inputs.run-id }} + RUN_ID: ${{ needs.source.outputs.run-id }} ARCH: ${{ matrix.platform.arch }} run: | - if [ -z "$RUN_ID" ]; then - RUN_ID=$(gh run list --workflow release.yml --branch release --limit 1 --json databaseId --jq '.[0].databaseId') - fi [[ "$RUN_ID" =~ ^[0-9]+$ ]] mkdir -p packages results gh run view "$RUN_ID" --json headSha,url > results/source.json