Problem/Motivation
I have run into an issue on a project which I think is going to crop up repeatedly and substantially increases risk of configuration conflicts resulting in branch merge issues; let me explain:
The webform fields are all in a single string in the form's yaml file as "elements", typically if there are changes by two developers on Drupal configuration, the changes are easy to view and merge as yaml has one setting per line. The elements string however presents a massive line with multiple changes.
Scenario 1: single branch conflicts
The initial issue came about where two developers were committing configuration changes to a webform configuration while working on the same branch. These although confusing were simple to merge as the deviation was manageable within that branch.
Scenario 2: feature branch conflicts
We have moved the project onto strict feature branch code management, which for the most part is a great idea, but for webform elements config, it is a nightmare.
- Developer needs to make a webform elements change
- branch from Master to new feature branch
- merge into develop for testing
- -- All OK at this point --
- Developer needs to make another webform elements change
- branch from Master to new feature branch (note branching off master again, so I don't have the other changes)
- merge into develop for testing
- deal with conflicts in elements string
- -- Got confusing with the merge --
- -- Do another --
- -- And another --
- -- Some changes are accepted for UAT --
- Developer re-merges some of the above feature branches into UAT branch (integration branch, develop branch being merged to master is potentially messy)
- Again deal with conflicts in elements string (but this is prone to error as it requires painstaking diff evaluation for each feature with changes to the webform)
Sorry I am trying to clearly state the issue, not sure I have managed.
Proposed resolution
You are the YAML expert, but would it be possible for the webform fields yaml to be stored in another configuration file? (shooting in the dark here)
Any suggestions anyone else?
PS: please don't read my tone as anything but constructive, the work done on this module is AMAZING.
Comment | File | Size | Author |
---|---|---|---|
#14 | webform_configuration-2910850-14.patch | 3.97 KB | jrockowitz |
| |||
#4 | webform_configuration-2910850-4.patch | 3.42 KB | jrockowitz |
| |||
#3 | webform_configuration-2910850-3.patch | 3.42 KB | jrockowitz |
|
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedMy immediate workaround was to create a `drush webform-tidy` command that converts the single line of elements to multiple lines of text, which makes it much easier to merge exported configuration.
Right now, the `drush webform-tidy` command only tidies exported module configuration but it could be updated to support a path and maybe even a config filename prefix as arguments.
drush webform-tidy --path='default/config_RYGDKJNWKJAHKJ/sync' -- prefix="webform"
Ideally, there should be a way to override the YAML serializer in core and tidy exported config, but this is not possible.
I feel this is a core issue since any YAML config containing multiple lines of text is more difficult to merge.
Comment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe attached patch allows for a `drush webform-tidy sync` command.
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch. Please download the latest release to review.
Now, you can add `drush webform-tidy sync` to your workflow when exporting config and git merges should be much easier.
The longterm solution would be to tidy all exported config in core. I am doubtful Drupal 8 core can alter the format of exported configuration files because this could break backward compatibility.
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #9
ABaier CreditAttribution: ABaier commentedHey Jacob,
I just tried to use this command and it seems to be not working if the config folder lies outside of the files directory.
We have the folders 'config' and 'config-local' (using the config_split module) one level above the web root, overridden in the settings.php. Since you removed the --path option, would there be a way to target the actively used config directories?
Thanks for your help!
Comment #10
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedWe should restore the --path option.
@ABaier Can you provide a patch?
Comment #11
ABaier CreditAttribution: ABaier commentedSorry Jacob, unfortunately I have never done that before and it would exceed my coding knowledge. Just saw it in comment #2 and thought that maybe could be a solution.
Comment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@ABaier No prob moving to 'Active'. I will try to get to this task in the next two weeks.
Comment #13
ABaier CreditAttribution: ABaier commentedGreat, thank you! I will try to help with testing and feedback.
Comment #14
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI decide to keep the command simple and you can just use
drush webform-tidy /some/path
Comment #15
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch. Please download the latest dev release to review.
Comment #16
ABaier CreditAttribution: ABaier commentedThanks Jacob! Works as expected. It seems that these changes were not yet in the latest dev branch, but I tested them manually.
I could successfully tidy all the webform config files in my custom directory using
drush webform-tidy /some/path
and also a single file adding--prefix=webform.webform.filename
. An import of these tidied files also worked without any problems.