Repository navigation
fix(devbase): repair the gh config directory ownership after a UID remap - #26
Merged
Merged
Conversation
…remap 2.1.0 created /var/lib/devbase/gh owned by the remote user at build time and relied on Docker seeding the new volume with that owner. The devcontainer CLI's updateRemoteUserUID layer then remaps the remote user to the host UID and re-owns only $HOME, so on any host whose UID is not the image's (GitHub runners are 1001) the volume came up owned by the stale UID and gh auth login failed with "permission denied". Post-create now repairs it: when the directory is not writable it runs sudo -n chown/chmod, proves the result with a second write probe, and reports with the manual fix when sudo is unavailable. It runs on every create, so every rebuild re-checks it. The tests assert the repair on a root-owned directory and the report when sudo fails. Refs: RSRMID-3096
Contributor
|
🎉 This PR is included in version 2.1.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: RSRMID-3096. Follow-up to #25, which shipped as devbase 2.1.0 with failing feature tests.
Problem
2.1.0 creates
/var/lib/devbase/ghowned by the remote user at build time and relies on Docker seeding the new volume with that owner. The devcontainer CLI then adds itsupdateRemoteUserUIDlayer (the image tag ends in-features-uid). That layer remaps the remote user to the host UID and re-owns only$HOME. On any host whose UID is not 1000 (GitHub runners use 1001), the volume comes up owned by the stale UID, andgh auth loginfails with "permission denied". That is worse than 2.0.2. Both jobs in #25 failed on exactly this: the "writable by the remote user" check, and the rebuild test writinghosts.yml.Change
devbase_setup_gh_config_dir(renamed fromdevbase_check_gh_config_dir) repairs the directory when it is not writable. It runssudo -n chown "$(id -u):$(id -g)"andchmod 0700, then proves the result with a second write probe. If sudo is unavailable or wants a password, it reports the manual fix and returns 0. It runs on every create, so every rebuild re-checks it.Tests
[ -O ]and a successful write.sudothat fails, the directory is reported and the function still returns 0.Releases as a patch (
fix(devbase)), 2.1.1.🤖 Generated with Claude Code