DecisionConfirm Drupal site configuration is always in a default state
Configuration should never be in an overridden state after configuration import(s) have been completed.
Table Of Contents
When there is overridden configuration it indicates that code and database are not in sync. This creates confusion as to if a branch is safe to merge or a release is safe to deploy.
After running the standard Drupal build steps we should
follow up with
drush config:status and check the results of that command for
No differences. If differences are
found we should fail the build.
[[ $(vendor/bin/drush config:status --format=json --state=Different) == '' ]] || exit 1
When the above status check fails, there are several steps developers can take to attempt to fix the issue.
- Double-check the config really isn't importable. Often, all that's needed is to commit missing new configuration files to the branch. Use
git statuslocally to double-check.
- Otherwise, start a new temporary branch from the latest commit on the
- Refresh the local database with the latest copy from production or whatever the upstream source is.
- Run the build steps.
- Copy the changes from the original branch to the new branch.
git cherry-pickis helpful here.
- Import the config with
- Verify there are no changes to export with
- If differences still show, there may be a bug in a module or in custom code.
- Roll back your changes to the last commit on main and re-import configuration.
- Recreate the configuration changes step-by-step, importing and exporting each time until the issue is found.
- Once found, file a bug ticket in the site project, or in the appropriate upstream project.
When configuration status checks fail, developers will need to determine how to resolve the error, which often might be as simple as re-exporting configuration and committing the changes.
- If a module was updated and introduced new configuration, a developer will need to re-export configuration to capture the changes.
- If a developer missed adding configuration changes to their pull request, they will need to re-create and export the configuration locally and push again.