mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Valery Kharseko
15 hours ago 5389e2f9f9f43b03d0115f94bdfc37b18ec4fd09
Run MSI tests after the Maven build matrix (#1325)

## Summary

- Remove the job that polls the GitHub API for the Windows MSI artifact.
- Run the MSI installation and upgrade tests after the full
`build-maven` matrix succeeds. Both jobs use the `windows-latest-11`
artifact.

## Checks

- `actionlint` on the build workflow
- Workflow dependency and artifact checks
- `git diff --check`
1 files modified
82 ■■■■■ changed files
.github/workflows/build.yml 82 ●●●●● patch | view | raw | blame | history
.github/workflows/build.yml
@@ -1445,86 +1445,8 @@
            rpm -e opendj
          '
  # The gate both MSI jobs wait on. Deliberately not "needs: build-maven": that waits for
  # the whole matrix, whose ubuntu legs run for about two hours, so any push landing inside
  # that window cancels the run before those two-minute jobs have started - which is how the
  # MSI work reached its eighth review round with no completed run behind it. The only input
  # they have is the windows-latest-11 artifact, so wait for exactly that.
  #
  # On ubuntu, and in a job of its own, for two reasons. A waiter on windows-latest holds a
  # Windows runner from t=0 for the whole wait, competing for the capacity the leg it is
  # waiting for needs - in run 31578978374 the windows-latest-11 leg sat in the queue for 38
  # minutes while windows-latest-26 started within one. And the wait was duplicated
  # verbatim in both jobs, with a 45-minute budget measured from t=0 that covered the leg's
  # runtime but not its queue time: in that same run the artifact appeared at +52 minutes,
  # so both jobs would have failed a perfectly healthy build.
  wait-msi-artifact:
    runs-on: 'ubuntu-latest'
    # The queue is not this run's to bound: it is a property of the account's runner
    # capacity, which GitHub shares across every OS, and the leg has been seen sitting in it
    # for three hours. So the wall clock here is only the six-hour ceiling GitHub puts on a
    # job, less a margin; what gets a budget is the leg's own runtime, which is the part a
    # change under test can actually break.
    timeout-minutes: 350
    permissions:
      contents: read
      # Listing the run's artifacts and jobs, which the wait below polls.
      actions: read
    steps:
      - name: Wait for the Windows build artifact
        shell: bash
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          # Four times the longest the leg has taken to publish, and counted only from the
          # moment it has a runner. The budget this replaces ran from t=0 and so was spent on
          # the queue instead: in run 34318105667 the leg waited 178 minutes for a Windows
          # runner and published 14 minutes later, an hour after a 120-minute budget had
          # failed a build that was entirely healthy.
          budget=$(( 60 * 60 ))
          deadline=''
          while true; do
            # A transient API error is a reason to poll again, not to read "not published
            # yet" out of a listing that never arrived: the leg may already have published,
            # and the completion check below would then call a healthy build one that
            # finished without publishing.
            if ! artifacts=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/artifacts" \
                 --jq '.artifacts[].name'); then
              sleep 30
              continue
            fi
            if grep -qx 'windows-latest-11' <<<"$artifacts"; then
              echo 'windows-latest-11 is available'
              exit 0
            fi
            if ! leg=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/jobs?per_page=100" \
                 --jq '.jobs[] | select(.name | startswith("build-maven (windows-latest, 11)")) | "\(.status) \(.conclusion)"'); then
              sleep 30
              continue
            fi
            case "$leg" in
              # Stop waiting the moment the leg that would publish it has finished without
              # doing so, instead of sitting out the deadline.
              completed*)
                echo "the Windows build leg finished as '${leg#* }' without publishing windows-latest-11" >&2
                exit 1
                ;;
              # It has a runner, so from here on the wait is on the build rather than on the
              # queue. A queued leg is listed too, and with a started_at holding the time it
              # was queued - which is why this reads the status and not that.
              in_progress*)
                [ -n "$deadline" ] || deadline=$(( $(date +%s) + budget ))
                ;;
            esac
            if [ -n "$deadline" ] && [ "$(date +%s)" -ge "$deadline" ]; then
              echo 'the Windows build leg has been running for 60 minutes without publishing windows-latest-11' >&2
              exit 1
            fi
            sleep 30
          done
  test-msi:
    needs: wait-msi-artifact
    needs: build-maven
    runs-on: 'windows-latest'
    permissions:
      contents: read
@@ -1720,7 +1642,7 @@
  # instance data in place, stops the running service for the file replacement and leaves
  # its registration alone, and that the upgraded server starts with the old data.
  test-msi-upgrade:
    needs: wait-msi-artifact
    needs: build-maven
    runs-on: 'windows-latest'
    permissions:
      contents: read