Skip to content

fix(ci): build rocky-8 as root instead of a created 'worker' user - #34

Open
gjed wants to merge 4 commits into
mainfrom
fix/rocky-8-build-user
Open

gjed wants to merge 4 commits into
mainfrom
fix/rocky-8-build-user

Conversation

@gjed

@gjed gjed commented Sep 18, 2026

Copy link
Copy Markdown
Member

Problem

rocky-8 build branch fails on every PR/build:

[buildStage] Creating build user 'worker' for rocky-8
+ id -u worker
+ useradd -m worker
useradd: Permission denied.
useradd: cannot lock /etc/passwd; try again later.
Failed in branch rocky-8

Root cause

buildUser: 'worker' + buildUserCreate: true is a leftover from the pre-container (v1 agent) pipeline. It's structurally incompatible with the v2 yap-rocky-8 container: its sudoers only whitelists NOPASSWD for yap, tee, yum, dnfuseradd isn't there, so any sudo useradd (with or without -u <user>) fails.

Verified directly against the pinned m0rf30/yap-rocky-8:2.6.2 image:

  • sudo useradd -m workersudo: a password is required (no NOPASSWD entry)
  • sudo -u worker dnf install ... (non-root) → Error: This command has to be run with superuser privileges — so even if the user existed, the preBuildScript step would still fail
  • plain sudo dnf install ... as root → succeeds (dnf is whitelisted)
  • bazel build as root in this container → succeeds

Fix

Drop the buildUser/buildUserCreate override entirely. rocky-8 now builds as root, same as rocky-9 and ubuntu already do successfully in this same pipeline.

Related

buildUser: 'worker' + buildUserCreate: true is a leftover from the
pre-container (v1 agent) pipeline. It's incompatible with the v2
yap-rocky-8 container: sudoers there only whitelists NOPASSWD for
yap/tee/yum/dnf, so `useradd -m worker` fails with "Permission denied"
(build #1-3 of PR-21).

Tested against the pinned m0rf30/yap-rocky-8:2.6.2 image directly:
- `sudo useradd -m worker` (no NOPASSWD entry) -> "a password is required"
- `sudo -u worker dnf install ...` (non-root) -> "has to be run with
  superuser privileges" -- so even creating the user wouldn't have
  fixed the preBuildScript step
- plain `sudo dnf install ...` as root -> succeeds (dnf is whitelisted)
- `bazel build` as root in this container -> succeeds

Drop the buildUser override entirely; rocky-8 now builds as root, same
as rocky-9 and ubuntu already do successfully.
@gjed
gjed requested a review from a team as a code owner September 18, 2026 14:42
@gjed gjed self-assigned this Sep 18, 2026
Comment thread Jenkinsfile Outdated
Bazel's rules_python refuses to run as root, so rocky-8 must build
unprivileged. The old override created a 'worker' user, which fails on
v2 nodes: sudoers only grants NOPASSWD for yap/tee/yum/dnf, so useradd
is denied.

The v2 image already ships a non-root user (yap, uid 1000), so reuse it
via buildUser instead of creating one. Run the dnf pre-build script with
explicit sudo (dnf is whitelisted) and set preBuildScriptSudo false so
it is not rewritten to 'sudo -u yap dnf', which lacks root. Add -s since
yap's dnf cache sync also needs root.

Verified against m0rf30/yap-rocky-8:2.6.2: bazel clears the root gate
and reaches target analysis.
Bazel sizes --jobs from the host /proc core count, not the cgroup quota,
so it spawned far more concurrent compiles than the 4-CPU/10Gi yap
container could hold. Every one of those held its own RSS while being
time-sliced onto 4 CPUs, which OOMKilled the container ~35 min in.

Pin --jobs to the CPU limit. No wall-clock cost: 4 CPUs was already the
real throughput ceiling.
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.

2 participants