Skip to content

Run the incremental build as a non-root user - #5707

Merged
anchapin merged 2 commits into
developfrom
ci-runner-nonroot
Nov 13, 2026
Merged

anchapin merged 2 commits into
developfrom
ci-runner-nonroot

Conversation

@anchapin

Copy link
Copy Markdown
Collaborator

Closes #5698. Part of #5696.

The job container now runs as uid/gid 123951 (the jenkins user on linux-openstudio-2) instead of root.

  • The build volumes on the host were chowned to that user (they were root-owned from earlier root jobs).
  • Checked in nrel/openstudio-cmake-tools:noble-main as that uid with the job's mounts: git fetch, ccache, conan remotes and profile, ruby, cmake, ninja, and writes to the build dir all work. Nothing else in the workflow needs root.
  • PR and branch jobs now build in separate -pr copies of the build dir and conan cache (host-side, NatLabRockies/cbci_jenkins_libs runner hook), so this file doesn't change for that.

Note: conan.openstudio.net's certificate expired 2026-11-12 13:58 UTC. With #5706's TLS verification, the conan step fails until it is renewed.

@anchapin
anchapin requested a balanced review from Copilot November 12, 2026 20:13

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue
What changed in this PR

Updates the incremental build GitHub Actions workflow to run the job container as a non-root user (host jenkins uid/gid), aligning container permissions with the ownership of host-mounted build volumes and improving isolation.

Changes:

  • Switches the container runtime user from root to 123951:123951 for the incremental build job.
  • Documents the rationale (host volume ownership and preventing out-of-scope writes) inline in the workflow.
File Description
.github/​workflows/​incremental-build.yml Runs the job container as the host’s non-root jenkins uid/gid to match mounted volume ownership and restrict write scope.

Review effort: Lite

Comment thread .github/workflows/incremental-build.yml Outdated
container: # Define the Docker container for the job. All subsequent steps run inside it.
image: nrel/openstudio-cmake-tools:noble-main
options: -u root # These options are passed to the 'docker run' command internally
options: -u 123951:123951 # the runner host's jenkins user, which owns the build volumes and _work (#5698); not root, so a job can't write outside what it owns

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Keeping the hard-coded uid on purpose. This job already belongs to one host: it targets the linux-openstudio-2 runner and mounts that host's /srv/data/jenkins/... paths, so the uid is the same kind of host fact as those paths. Putting it in a repo variable would hide it from this file without making the workflow work on another runner. If the host is rebuilt, its runner config has to change anyway (tracked in NatLabRockies/cbci_jenkins_libs infra/github-runner). One portable option for later is to have the host's container hook set the user, so the workflow doesn't name a uid at all.

… accurate comment

- CMP0206 NEW: CMake >= 4.3 then writes uid/gid 0 in CPack archives instead of the
  build user's uid (123951 on the self-hosted runner)
- the job now owns the clone, so git's ownership check passes without safe.directory *
- the user comment no longer claims the job can't write shared build state
@anchapin
anchapin merged commit 35a3465 into develop Nov 13, 2026
13 checks passed
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.

incremental-build: run the job container as non-root instead of -u root

2 participants