Skip to content

Make the apt install in the lib-python jobs survive a stalled mirror - #4132

Open
slachiewicz wants to merge 1 commit into
apache:masterfrom
slachiewicz:ci-apt-install-action
Open

slachiewicz wants to merge 1 commit into
apache:masterfrom
slachiewicz:ci-apt-install-action

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

The lib-python (3.12) leg of #4122 (run 42256683325) spent its whole 20 minutes inside "Install dependencies" and was cancelled with only "The job has exceeded the maximum execution time of 20m0s" to show for it. .github/apt/99-ci-network (#3841) bounds a mirror that stops answering, but not one that keeps trickling bytes, and nothing stops the runner's apt-daily timers from taking the dpkg lock under the install.

This adds a composite action, .github/actions/apt-install, that does the following:

  • copies the CI apt settings as before,
  • disarms apt-daily.timer and apt-daily-upgrade.timer and waits up to 120 s for a run already in flight instead of killing it mid-dpkg,
  • runs apt-get update and install under timeout, so one attempt has a budget (45 s and 120 s by default) rather than the job's,
  • retries up to three times, pointing the sources at https://archive.ubuntu.com from the second attempt on instead of the runner's mirror list, and runs dpkg --configure -a first in case the previous attempt was stopped half-way through a package.

The lib-python jobs of build.yml and sca.yml use it, referenced with the $/ self-repository syntax, with a step-level timeout-minutes: 15 as the backstop: a run that still exceeds the budget fails on that step with the attempts visible in the log, not as a cancelled job. The sca.yml job has no job timeout, so that step timeout is its only bound.

The PR does not move the other jobs' apt steps; they can follow once the action has proven itself here.

Verified: zizmor --offline → no findings on the action and both workflows; install.sh against stubbed apt-get/dpkg → stalled update ends with status 124, sources rewritten, dpkg --configure -a, retry.

  • Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

Generated-by: Claude Fable 5.1

Copilot AI balanced review requested due to automatic review settings November 7, 2026 10:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@mergeable mergeable Bot added the github_actions Pull requests that update GitHub Actions code label Nov 7, 2026
@Jens-G

Jens-G commented Nov 13, 2026

Copy link
Copy Markdown
Member

Code review

No blocking issues found. Checked for bugs and CLAUDE.md compliance.

Two suggestions, below the bar for an issue but verified:

  • read -r -a packages <<< "$PACKAGES" takes only the first line of the input. Today's caller passes a single line, so it works. A later caller that lists its packages one per line in a packages: | block, the shape the cross-test job's install step has now, would get only the first line installed, and the step would still pass. With PACKAGES=$'openssl\nca-certificates\nlibboost-all-dev\n', read -r -a yields (openssl) and read -r -d '' -a yields all three. The script has no set -e, so the non-zero status of the latter at the end of input does no harm.

read -r -a packages <<< "$PACKAGES"
archive=http://archive.ubuntu.com/ubuntu/

  • A small formality: the commit message has no Client: line. CI-only commits on master carry Client: build, the ones without a ticket included (6020828, 44d082d).

🤖 Generated with Claude Code

@slachiewicz
slachiewicz force-pushed the ci-apt-install-action branch from 0dac8e3 to b7adbc4 Compare November 13, 2026 16:58
Copilot AI balanced review requested due to automatic review settings November 13, 2026 16:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Comment thread .github/workflows/build.yml Fixed
@slachiewicz
slachiewicz force-pushed the ci-apt-install-action branch from b7adbc4 to a099305 Compare November 21, 2026 09:04
Copilot AI balanced review requested due to automatic review settings November 21, 2026 09:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@slachiewicz
slachiewicz force-pushed the ci-apt-install-action branch from a099305 to 2667d47 Compare November 21, 2026 11:07
Copilot AI balanced review requested due to automatic review settings November 21, 2026 11:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@slachiewicz
slachiewicz force-pushed the ci-apt-install-action branch from 2667d47 to 3d9d7c2 Compare November 21, 2026 16:04
Copilot AI balanced review requested due to automatic review settings November 21, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@slachiewicz slachiewicz changed the title Make the apt install in lib-python survive a stalled mirror Make the apt install in the lib-python jobs survive a stalled mirror Nov 21, 2026
Client: build

The lib-python job spends its whole 20 minutes in apt-get when an Ubuntu
mirror stalls, and the log then only says that the job was cancelled.
.github/apt/99-ci-network bounds a mirror that stops answering, but not
one that keeps trickling bytes, and nothing stops the runner's apt-daily
timers from taking the dpkg lock under the install.

Add a composite action, .github/actions/apt-install, that

  * copies the CI apt settings as before,
  * disarms apt-daily.timer and apt-daily-upgrade.timer and waits for a
    run already in flight instead of killing it mid-dpkg,
  * runs apt-get update and install under `timeout`, so one attempt has
    a budget (45 s and 120 s by default) rather than the job's,
  * retries up to three times, pointing the sources at archive.ubuntu.com
    from the second attempt on instead of the runner's mirror list, and
    runs dpkg --configure -a first in case the previous attempt was
    stopped half-way through a package.

The lib-python jobs of build.yml and sca.yml use it with a step-level
timeout-minutes as the backstop, so a run that still exceeds the budget
fails on that step with the attempts in the log, not as a cancelled job.
The sca.yml job has no job timeout at all, so the step timeout is its
only bound. The other jobs can move to the action once it has
proven itself there.

The local action is referenced with the self-repository `$/` syntax that
zizmor asks for, and the two new files carry ASF license headers. The
fallback points at HTTPS, and the wait for apt-daily services is bounded.
At the default budgets the timer wait and the apt-get calls of all three
attempts fit under the step timeout, and so does one stalled
dpkg --configure between attempts; two stalled ones do not.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@slachiewicz
slachiewicz force-pushed the ci-apt-install-action branch from 3d9d7c2 to 3d6a96f Compare November 21, 2026 16:08
Copilot AI balanced review requested due to automatic review settings November 21, 2026 16:08
@slachiewicz

Copy link
Copy Markdown
Member Author

Thanks, both are in 3d6a96f0f: install.sh reads the list with read -r -d '' -a, so a packages: | block with one package per line installs every line, and the commit carries Client: build.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants