Repository navigation
feat(devbase): persist the gh login across container rebuilds - #25
Merged
Merged
Conversation
ghCredentialHelper makes gh the only git credential helper, but gh kept its
login in ~/.config/gh, which nothing persisted. Every rebuilt container was
logged out, and every HTTPS git operation failed with "terminal prompts
disabled" until someone ran gh auth login by hand.
The Feature now mounts a per-devcontainer named volume
(devbase-gh-${devcontainerId}) at /var/lib/devbase/gh and points
GH_CONFIG_DIR at it. install.sh creates the directory owned by the remote
user so Docker seeds the empty volume with that ownership. Post-create
verifies the directory is writable and reports the fix if not; post-attach
warns when gh holds no token and names gh auth login. No host path is
mounted.
validate-features.sh fails when the path disagrees between the mount,
containerEnv and install.sh. The features suite covers the mount, its
ownership and the logged-out and logged-in attach cases; a new rebuild job
(pnpm features:test:rebuild) brings a container up, seeds a login, rebuilds
with --remove-existing-container and checks the login is still there.
Refs: RSRMID-3096
Contributor
|
🎉 This PR is included in version 2.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This was referenced Oct 28, 2026
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
Problem
ghCredentialHelpermakesgh auth git-credentialthe only git credential helper, but gh kept its login in~/.config/gh, which nothing persisted. Every rebuilt container was logged out, and every HTTPS git operation failed withterminal prompts disableduntil someone rangh auth loginby hand. Nothing said so.Change
devbase-gh-${devcontainerId}, at/var/lib/devbase/gh, and setscontainerEnv.GH_CONFIG_DIRto that path. No host path is mounted (cf. RSRMID-3052).install.sh: creates that directory owned by the remote user (mode 0700). Docker seeds an empty named volume with that ownership.devbase_check_gh_config_dirproves the directory is writable with a real write. If it is not, it reports thechown/ remove-the-volume fix. It never uses sudo and is never fatal.devbase_check_gh_loginwarns and namesgh auth loginwhen gh has no token. It usesgh auth token, which is local, needs no network, and honoursGH_TOKEN. It runs only withghCredentialHelperon, is independent of the banner, and always exits 0.validate-features.sh: fails when the path disagrees between the mount target,GH_CONFIG_DIRandinstall.sh.mountsrule now allows exactly this one volume. A consumer can stop gh using it by setting their ownGH_CONFIG_DIR, but cannot stop the volume from mounting.Tests
GH_CONFIG_DIRvalue, that the path is a mount, that it is writable, that a logged-out gh warns while the helper stays configured, that a logged-in gh stays quiet, and that an unwritable directory is reported.minimal.shchecks that no warning appears with the helper off.rebuildjob (pnpm features:test:rebuild): brings a scratch devcontainer up, asserts the first-create warning, seeds a login, then rebuilds with--remove-existing-container. It asserts the rebuild produced a new container, that the same volume is attached, that the login survived, and that attach is quiet.ci-successnow gates on both jobs.Not verified locally
There is no Docker daemon in the dev container, so none of the container tests (old or new) have run before this PR. This CI run is their first. Two premises are worth watching: that
devcontainer features testapplies a Feature'smounts, and that gh accepts the seededhosts.yml. Each has its own explicit failure message. The new checks have also not yet been shown to go red against a deliberately broken implementation, as CLAUDE.md asks for.Releases as a minor (
feat(devbase)).🤖 Generated with Claude Code