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
fix: ddev config should not change unspecified options, fixes #5882 #5887
fix: ddev config should not change unspecified options, fixes #5882 #5887
Conversation
Download the artifacts for this pull request:
See Testing a PR |
b63c6fc
to
b03fd4a
Compare
Wow, you got a clean colima/github test! |
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.
Thanks for adding test coverage. Please update the OP to state the full expected behavior in the various situations:
- Config.yaml specifies a set of configs but there's no code to match it (the bug here). (This can be more than just project type I think, docroot as well).
- Config.yaml specifies a set of configs but the code found by DDEV discovers other things (configured for drupal10, finds magento2)
- Initial configuration autodetect, which is good, but of course doesn't work when there's no code.
- There may be other permutations, but this basic problem has dogged people from time to time.
Part of the issue is that during the lifetime of DDEV people have moved from initial setup being a git checkout of existing code (with docroot, etc) to where they often start a project with no code at all and a ddev composer create
. So the code changes after the configuration is done. And of course, the configuration might not have been right.
b03fd4a
to
e461701
Compare
Rebased and updated the OP with the expected behavior. |
👍 Using v1.22.7-48-ge461701c1, this use case now seems to work perfectly on Ubuntu:
Thanks! |
e461701
to
af3d18a
Compare
Rebased |
af3d18a
to
32bda6a
Compare
Rebased. |
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.
Thanks, this is great.
I also manually tested with lots and lots of permutations, and it all behaved as expected.
The Issue
ddev config
if no recognized code detected #5882The bug introduced in
The expected behavior for
ddev config
in the various situations:config.yaml
specifies a set of configs but there's no code to match it (the bug here). (This can be more than just project type I think, docroot as well).Running
ddev config
on existing code should not change existing config options that are not specified.For example, when you run
ddev config --web-environment-add FOO=bar
on a project with the latest config (updating the outdated configuration is mentioned later), it should only change theweb_environment
option, and nothing else. This is covered in this PR inTestConfigSetValues
- this test checks a lot of configuration options, so I think we are safe here.config.yaml
specifies a set of configs but the code found by DDEV discovers other things (configured fordrupal10
, findsmagento2
)If the auto-detected project type is different from the one specified by the user, an additional run of
ddev config
should just show a warning about it, and not add project-specific files of the auto-detected project type. The user's preference should be respected, and if they choosedrupal10
, thedrupal10
settings file (i.e.settings.ddev.php
) should be added even ifmagento2
is automatically detected. This is true untildisable_settings_management: true
, when all settings are ignored. The project type change is covered in this PR inTestConfigSetValues
- if the type is auto changed, we will know about it immediately.Initial configuration autodetect, which is good, but of course doesn't work when there's no code.
ddev config --auto
should automatically detect the project type and set other options depending on the project type, but this only applies to the first project config run, all otherddev config --auto
should respect the user's decision and only remove deprecated (i.e. outdated) or non-existent config options. This does not require testing, asyaml.Marshal()
is used forapp.WriteConfig()
and all junk configs will always be removed. And auto-detection itself is covered by several tests withDetection
in the name.config.yaml
merges additional config.*.yaml, and you can override config instead of merging withoverride_config: true
This is explained in the docs and covered with
TestConfigOverrideDetection
.How This PR Solves The Issue
Fixes an issue with overriding the project type when it should not have been changed.
Checks for this bug with a test.
Manual Testing Instructions
ddev config --auto && ddev config --project-type drupal10 && ddev config --auto
drupal10
, notphp
.Automated Testing Overview
Related Issue Link(s)
Release/Deployment Notes