New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: generalize HOMEDIR management and respect XDG_CONFIG_HOME, fixes #5807 #5813
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking forward to test results. Will require excellent manual testing.
Static validation failures are due to upgrade of golanci-lint, will be fixed shortly in That should go in at least by tomorrow. |
Thanks. I'll circle back to this Monday to clean up tests and any other issues. |
Download the artifacts for this pull request:
See Testing a PR. |
@danepowell could you please PM me any way you want about some Acquia things? Discord probably best, but email and other contacts are on https://github.com/rfay |
Looks like TestCreateGlobalDdevDir will need some attention. When you rebase this the static validation will be fixed. |
The tests now pass locally (woot! 😄 ) The problem is they inherit certain properties of the host environment, namely the OS config dir. So I have to hardcode |
This should be ready for review. The tests are still a little flaky on my local but I think that's due to some kind of interference between the test fixtures and my host environment. It also seems like some of the failing tests in CI are unrelated to this PR. |
One thing to know is that since it's your first PR, each push has to be approved for testing. So ping me if you push and need to see the new results. I see your pushes, so will try to make sure I start when it happens. Use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works great! Uses the ~/.ddev/
dir if that exists (which it will for existing installations), but if that dir doesn't exist it'll create (or use if it exists) the ddev/
dir in the configured config dir.
Can't test for mac or windows, but works great in gitpod and locally on ubuntu.
The failing colima test is probably a red herring, that test likes to fail (@rfay I thought you'd given me access to rerun these but it looks like I can't? I can only rerun buildkite CI it looks like)
Just had a thought - there's a bunch of code comments (and maybe docs?) that refer to |
One of the problems with Gitpod is that the homedir is not persistent. I think we could actually use this to solve that problem on gitpod! /cc @shaal . /workspace is what persists there, so we could use actually /workspace itself as $XDG_CONFIG_HOME. Huge win! |
I think there's a lot of little things that do need to be taken care of, https://github.com/search?q=repo%3Addev%2Fddev%20~%2F.ddev&type=code - most of them are not important but there are a few that are. I'm OK with doing this as a followup, but some of those look really important. The code situations (not comments) absolutely have to be taken care of. |
I hadn't considered how many (156, at least 😄 ) hardcoded references to I don't think we actually have to fix any of those immediately. In fact, we might be better off waiting until the next major release, when/if support for I'd suggest that the one exception is public-facing docs. We should update those in order to avoid confusion where new users go looking for Let me know what you think. |
I'd strongly disagree with that. Who knows what random bugs will suddenly appear because someone does a fresh install, their config is put in the new place, but the hardcoded references are looking in the wrong place... |
The ones in Dockerfiles aren't relevant. I haven't looked through all of them, but it seems to me like we have more to do than originally intended. |
The problem is that some of those file are shell scripts and other non-Go libraries, so they can't take advantage of the same config directory logic. They'll need to use XDG_CONFIG_HOME and maybe even implement a fallback mechanism if it's not set. I'll be honest, that takes this far beyond what I was hoping to accomplish as a "20% project". I'm also going to be out of office until March. I'll try to check back in when I return. |
I think this is a great initiative. The ones that affect scripts are not all relevant, and the ones that take place inside containers are not relevant. But the golang ones that are for things other than ~/.ddev (like ~/.mutagen_data_directory) are obviously critical. Of course... moving .mutagen_data_directory into ~/.ddev would make a lot more sense. Thanks so much for this work, and I hope it works out. |
Moved back to draft so it can't be accidentally pulled. |
fb6c975
to
a95bba1
Compare
Rebased on the master. This is an interesting PR and I'm going to continue working on it. I think it's worth making I like the way it is done for git:
So, if the user decides to move |
Sounds good to me, thanks for picking this up! |
Co-authored-by: Randy Fay <randy@randyfay.com>
This reverts commit 81aacd4.
Changes:
|
The Issue
This is my first time touching Go so please "go" easy on me! 😄 Thanks for having great documentation, good code, and an easy build process that made it a pretty easy learning process.
How This PR Solves The Issue
Allows to move the global
~/.ddev
directory to$XDG_CONFIG_HOME/ddev
or predefined OS specific location:~/.config/ddev
on Linux and WSL2 onlyIf there are multiple DDEV global configurations, they are checked with the following priority:
$XDG_CONFIG_HOME/ddev
~/.config/ddev
on Linux and WSL2 only~/.ddev
The current location of the configuration directory can be checked using
ddev version | grep global-ddev-dir
Switches from
~/.ddev/mutagen_data_directory
to~/.ddev/.mdd
Adds check for Mutagen socket length. See:
TODO (probably not in this PR):
XDG_CONFIG_HOME=/workspace/.config
andmkdir -p $XDG_CONFIG_HOME/ddev
Manual Testing Instructions
Check moving ~/.ddev without using
$XDG_CONFIG_HOME
(on Linux and WSL2):~/.ddev
to OS specific config folder:~/.config/ddev
on Linux and WSL2~/.ddev_mutagen_data_directory
does exist.ddev list
ddev version | grep global-ddev-dir
to confirm that directory is different from~/.ddev
~/.ddev
is not recreatedddev start
~/.ddev_mutagen_data_directory
should be deleted..ddev
back to~/.ddev
and confirm that everything works as beforeRepeat all steps from 1, but this time use
export $XDG_CONFIG_HOME=/custom-path && mkdir -p $XDG_CONFIG_HOME/ddev
Check Mutagen error for really long path to its socket:
ddev config global --performance-mode=mutagen
ddev mutagen version
output$XDG_CONFIG_HOME
to some really long path, in result the full path to$XDG_CONFIG_HOME/ddev/.mdd/daemon/daemon.sock
should be at least 104 characters on macOS or 108 characters on Linuxmkdir -p $XDG_CONFIG_HOME/ddev
ddev mutagen version
output (the locations should be different).ddev start
and see a warning for too long pathAutomated Testing Overview
Tests that changed
$HOME
are rewritten to use$XDG_CONFIG_HOME
(except forTestCreateGlobalDdevDir
, that needs to create a directory).Related Issue Link(s)
Fixes #5807
Release/Deployment Notes
This PR doesn't introduce any breaking changes, it adds more options for moving the DDEV global config directory to another location.