feat: persist selected ~/.config dirs to /shared (adds gcloud)#9
Merged
Conversation
Add a generic symlink_shared_config helper + a SHARED_CONFIG_DIRS list so ~/.config/<name> directories can be persisted to /shared/.config and survive workspace rebuilds. Seeds the list with gcloud (so application-default / ADC credentials persist). Add more directory names to SHARED_CONFIG_DIRS to share additional config folders.
There was a problem hiding this comment.
Pull request overview
This PR enhances the Coder workspace shared-config setup to make persisting ~/.config/<tool> directories to /shared/.config/<tool> reusable and list-driven, so tool credentials/config survive workspace rebuilds (seeded with gcloud).
Changes:
- Added a reusable
symlink_shared_config <name>helper to migrate an existing real~/.config/<name>into/shared/.config/<name>and then symlink it back. - Introduced a
SHARED_CONFIG_DIRSlist to drive which~/.config/*directories get persisted (initially:gcloud). - Kept the existing special-case GitHub CLI (
gh) seeding/symlink logic intact.
cp could partially fail (permissions/special files) while the script still moved the original aside and symlinked to an incomplete /shared copy, leaving the real config only in the backup. Use cp -a and abort the migration (leaving the real config in place) if the copy fails.
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.
Summary
Generalizes the Coder shared-config symlinking so any
~/.config/<name>directory can be persisted to/shared/.config/<name>and survive workspace rebuilds — instead of a hardcoded per-tool block.symlink_shared_config <name>helper insetup-shared-symlinks: migrates an existing real~/.config/<name>into the shared location once (with a timestamped backup), then symlinks~/.config/<name>→/shared/.config/<name>.SHARED_CONFIG_DIRSlist driving it — add a directory name to share another config folder.gcloud, sogcloudcredentials (including application-default / ADC) persist across rebuilds.Why
.configis skipped by the generic home-dir symlink loop (chezmoi-managed), so previously onlyghwas special-cased. Workspace rebuilds wiped~/.config/gcloud, dropping ADC and breaking anything needing GCP creds (e.g. Vertex AI at service startup). This makes adding more shared.configfolders a one-line list edit rather than a copy-pasted block.Adding more folders
SHARED_CONFIG_DIRS=( gcloud # add more here, e.g. some-tool )Notes
ghkeeps its existing dedicated block (it has a dotfiles-seededhosts.ymlbootstrap); only the generic.configfolders go through the new helper.