Skip to content

Install CI packages through an apt helper that skips the Microsoft source - #868

Merged
fcostaoliveira merged 3 commits into
masterfrom
claude/ci-apt-hardening-866
Oct 25, 2026
Merged

fcostaoliveira merged 3 commits into
masterfrom
claude/ci-apt-hardening-866

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #866.

Problem

GitHub's Ubuntu runner images ship a packages.microsoft.com source that memtier never installs from. When that repo returns 403, apt-get update exits 100 and the job fails before it builds or runs anything. This happened on 2026-10-23 (ASAN Single Endpoint: TCP Plaintext) and on 2026-10-25 (UBSan TCP TLS scan-staircase, on #865). No workflow retried apt.

Change

New utils/apt_install.sh [--no-update] [apt-get install options] package...:

  • Unused source: it disables /etc/apt/sources.list.d/microsoft-prod.list (and a .sources variant) by renaming it to *.disabled. That is the only file packages-microsoft-prod.deb installs on the 22.04 and 24.04 images. packages.redis.io and every other source stay.
  • Retries: it runs apt-get -qq update, then apt-get install with the caller's flags unchanged. Each step gets 3 attempts, 10 s then 20 s apart, and a failed install refreshes the lists before its retry.
  • Real errors: an unknown package fails at once, without a retry. apt's output is streamed, and the final message says whether update or install failed.
  • sudo: it uses sudo only when not running as root, so container jobs call it the same way.
  • --no-update: for a second install in a job that already ran the update.

It is modelled on #844's pip helper (utils/install_test_requirements.sh).

Workflows: 38 sites across 12 workflow files now call the helper.

  • Extra checkouts: the soak, CLI-fuzz and monitor-fuzz nightlies also build the 2.4 branch, which has no helper, so those jobs sparse-check it out from the workflow revision into .apt-helper. publish-to-yum gets a sparse checkout as well.
  • Left as is: two sites in Debian/Ubuntu containers, which have no Microsoft source. One is the git install in test-debian-versions, which runs before the checkout. The other is smoke-test-packages in release.yml, which has no checkout and installs local .deb files.

Self-test: utils/test_apt_install.sh runs the helper against a stub apt-get and a temporary sources directory, with no root. The non-root distcheck job in ci.yml runs it.

Validation

  • The self-test passes under dash and bash.
  • Six helper mutants fail it: fewer attempts, no source disabling, no unknown-package check, no list refresh before an install retry, ignoring a failed update, and dropping the install arguments.
  • actionlint 1.7.12 reports the same 3 findings as on master, all in files this PR doesn't touch.
  • Every workflow parses, and git diff --check is clean.
  • The CI run on this PR exercises the helper in every workflow it touches.

Merges cleanly with #855, #822, #851, #823 and #545. #545 adds libevent-compat.yml with 4 plain apt-get lines; whichever of the two merges second should switch those to the helper.

Affected versions

CI configuration only; no released memtier binary or package is affected. The bare apt-get update steps date from c9278c0 (#114). The 2.* maintenance branches run the same workflows (#549), but they won't have the helper until it is backported.

🤖 Generated with Claude Code


Note

Low Risk
CI-only packaging glue; no memtier binary or release artifact logic changes beyond how Ubuntu runners invoke apt.

Overview
Adds utils/apt_install.sh so CI can install Debian packages without flaky apt-get update failures when GitHub runners’ unused packages.microsoft.com repos return 403 (#866). Before update/install, the helper renames any .list/.sources entry pointing at Microsoft to *.disabled, retries update and install up to three times (with list refresh on install retry), supports --no-update for follow-on installs, and fails fast on missing packages.

utils/test_apt_install.sh exercises that behavior with a stub apt-get (no root); ci.yml runs it in the distcheck job.

Across 12 workflow files (~38 call sites), raw sudo apt-get update + install is replaced with the helper. Nightly jobs that build 2.4 sparse-checkout only utils/apt_install.sh from the workflow SHA into .apt-helper because maintenance branches may lack the script; publish-to-yum does a similar sparse checkout. A few container paths still use plain apt-get (e.g. git before checkout on Debian matrix, release smoke .deb install).

Reviewed by Cursor Bugbot for commit e698ad3. Bugbot is set up for automated code reviews on this repo. Configure here.

fcostaoliveira and others added 2 commits October 25, 2026 04:57
…urce

GitHub's Ubuntu runner images ship a packages.microsoft.com source that
memtier never installs from. When it answers 403, apt-get update exits
100 and the job fails before any memtier code runs, as in the ASan and
UBSan (scan-staircase) jobs in #866.

Add utils/apt_install.sh and call it at the apt-get update/install sites
of every workflow. It renames the runner's
/etc/apt/sources.list.d/microsoft-prod.list (the file that
packages-microsoft-prod.deb installs on Ubuntu 22.04 and 24.04; also a
.sources variant) to *.disabled, which apt skips silently. Other sources,
including packages.redis.io, stay. It then runs apt-get -qq update and
apt-get install with the caller's arguments, 3 attempts each, 10 s then
20 s apart; a failed install refreshes the package lists before the
retry, and an unknown package fails at once. apt's output is shown, and
the final failure names the step. --no-update skips the update for a
second install in the same job. It uses sudo unless already root, so the
container jobs call it the same way.

The soak, CLI-fuzz and monitor-fuzz nightlies also build the 2.4 branch,
which has no helper, so they take it from the workflow revision with a
sparse checkout, as monitor-fuzz already does for its harness.
release-rpm's publish-to-yum job had no checkout and gets a sparse one.

Two sites keep plain apt-get: the git install in test-debian-versions
runs before the checkout, and release.yml's smoke-test-packages has no
checkout; both run in Debian/Ubuntu containers, which have no Microsoft
source.

utils/test_apt_install.sh tests the helper against a stub apt-get and a
temporary sources directory, without root; the non-root distcheck job
runs it.

Fixes #866

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add cases for a deb822 microsoft-prod.sources, a source that cannot be
disabled, a package with no installation candidate, and an install retry
whose package-list refresh keeps failing. Each catches a helper change
the self-test missed before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8e8824b. Configure here.

Comment thread utils/apt_install.sh Resolved
Match a source file by the host it names rather than by its file name, so
one installed under another name, such as an azure-cli source, is
disabled too. The self-test adds such a file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

Review summary for e698ad3. All 7 lenses approve (semantics, output, tests, lifecycle, interactions, maintainability, build).

  • Helper: apt-get's exit status gets through under dash, bash and busybox. Arguments with spaces pass through unchanged, and an unknown package fails at once. The self-test kills all 40 mutants it was tried against.
  • Workflows: all 38 converted sites pass the same packages and flags as before, and every hosted job installed the same package versions as master.
  • Bugbot's azure-cli thread: answered and resolved. The helper now disables any source that names packages.microsoft.com. In this run, every one of the 101 hosted jobs (28 on ubuntu-22.04, 73 on ubuntu-24.04) disabled exactly one file, microsoft-prod.list, so neither image has a second Microsoft source today.
  • CI: 144 jobs passed and 6 were skipped by label or release gating. 15,651 tests ran, with 0 failed.
  • Still untested: the nightly soak, CLI-fuzz and monitor-fuzz jobs, and the differential workflow, use the helper through new sparse checkouts that no PR run covers. They will first run on the next nightly or manual dispatch, and I'll check those runs.
  • Add libevent build helper and compatibility CI for 2.1.12, 2.1.13 and 2.2.2-alpha #545: its new libevent-compat.yml still has 4 plain apt-get lines. They should move to the helper once both PRs have landed.

@fcostaoliveira
fcostaoliveira merged commit a331106 into master Oct 25, 2026
151 checks passed
fcostaoliveira added a commit that referenced this pull request Oct 25, 2026
Master now routes CI apt installs through utils/apt_install.sh (#868),
which drops the runner's packages.microsoft.com source and retries
update and install. The compat cells were left on bare apt-get, so a 403
from that source would fail them before building. Use the helper for
the build dependencies and Redis, and add it to the harness regex.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: jobs fail in apt-get update when an unused runner package source (packages.microsoft.com) returns 403

1 participant