Building:Configuration Management - cu-uis/cu-starterkit-project GitHub Wiki
UPDATE NEEDED
- Adjust for use of config splits -https://www.drupal.org/docs/contributed-modules/configuration-split/creating-a-simple-split-configuration-dev-modules-only
Drupal provides User Interfaces (UI) that allow users with specific permission to modify many settings. These changes result in .yml files. YAML is a human-readable data-serialization language commonly used for configuration files. There are really only 3 options to manage these YAML changes.
- Lock users out of the UIs that result in YAML changes
- Ignore the changes in the export or import
- Use a process to get the YAML updates captured in code
Most sites need someone to modify settings managed as YAML while building the site. These users won't need to know any PHP or even CSS and Twig. They simply export the configuration from the site and add it to the version control system for the site. These users should be given the role of Site Builder and follow this process for managing these changes.
Making a Merge Request of Configuration Changes with SmartGit and GitLab
- Install https://www.syntevo.com/smartgit
- While connected to the VPN, go to https://gitlab.cu.edu/ode/[PROJECT]
- (1) Click Repository on the left hand menu
- (2) Click the blue Clone button in the upper right
- (3) Copy the URL under Clone with HTTPS
- In SmartGit, under Repository select Clone
- Login using your CU username/password
- Select the master branch to clone and select where on your computer you want to store these files
- Once the cloning is complete, under Branch select Add Branch
- Name your branch using this pattern [GITLAB ISSUE NUMBER]-description
- Click Add Branch and Checkout
Now that you have a local copy of the code, you need to export the changes made in the Drupal instance you've been working in. The easiest way to do this is with a batch export. This will create a .tar.gz download of the all the .yml files of the current site configuration. Configuration > Development > Configuration synchronization > Export
Download the .tzr.gz file.
Expand that file
Either copy the specific yml files or all of the files into sites/default/config
Drag files to Clone > Sites > Default > Config > drop exported setting files
Files with differences will be highlighted
In SmartGit will display changes in left hand window
Highlight changes, right-click “Commit”.
Add message in “Commit Message” window and also on Git# card.
Click Push > Push
In GitLab
Merge Requests > refresh > create merge request
Paste Title into title text box
Add many details below about the changes to deploy
Making a Merge Request of Configuration Changes with DDEV and GitLab
The process of updated the .yml files when using a local development environment requires fewer steps, but assume you have DDEV installed, the Pantheon provider configured and Teminus.
- Create an issue in GitLab to titled Synchronize Live Site's Config Changes
- While on a current master branch, create a branch for the issue in in gitlab using
git checkout -b [ISSUE#]-m
- Clone the most recent backup of the database and files to your local environment using
ddev pull pantheon -y
- Clear/rebuild the local cache before exporting
ddev drush cr
- If you have configured Structure Sync to manage specific taxonomies, menus or , use
ddev drush et/eb/em
or the export all option withddev drush ea
. - Export the site's current config to file using
ddev drush cex -y
- Check that the configuration files you expect to see updated were using
git status
- Commit the changes using
git commit -am "Synchronize config for..."
- Push the changes using
git push origin [ISSUE#]-m
- In GitLab, create the merge request
After these changes have been merged, the config still needs to be imported into the site after the using Terminus or the Pantheon Dashboard to deploy the changes. The import can be done with the Structure Sync and Configuration Management UI or Terminus using terminus drush [SITE].[ENV] -- config:import -y
and terminus drush [SITE].[ENV] -- ia -y