az-digital / az_quickstart

UArizona's web content management system built with Drupal 10.
https://quickstart.arizona.edu
GNU General Public License v2.0
30 stars 20 forks source link

Create script for checking config differences with PR applied. #2089

Open trackleft opened 1 year ago

trackleft commented 1 year ago
#!/bin/sh
set -x +e

# Find differences in config
mkdir -p config/sync
drupal config:export --remove-uuid --remove-config-hash --directory=config/sync
touch list-of-config-folders.txt

find . -type d -name "install" >> list-of-config-folders.txt
find . -type d -name "quickstart" >> list-of-config-folders.txt
find . -type d -name "optional" >> list-of-config-folders.txt

while IFS= read -r FOLDER; do
    rsync config/sync/* ${FOLDER}/. --existing </dev/null
done < list-of-config-folders.txt

Works with the following caveats

  1. Metatag field is overridden in az_seo/config/quickstart
  2. system.site.yml should have differences
  3. Permissions will be different.
trackleft commented 1 year ago

Contents of list-of-config-folders.txt

./config/install
./modules/custom/az_person/config/install
./modules/custom/az_global_footer/config/install
./modules/custom/az_news/config/install
./modules/custom/az_news/az_news_feeds/config/install
./modules/custom/az_flexible_block/config/install
./modules/custom/az_cas/config/install
./modules/custom/az_migration/config/install
./modules/custom/az_course/config/install
./modules/custom/az_block_types/config/install
./modules/custom/az_block_types/az_custom_menu_block/config/install
./modules/custom/az_block_types/az_block_types_quick_links/config/install
./modules/custom/az_seo/config/install
./modules/custom/az_carousel/config/install
./modules/custom/az_flexible_page/config/install
./modules/custom/az_core/config/install
./modules/custom/az_alphabetical_listing/config/install
./modules/custom/az_google_tag/config/install
./modules/custom/az_paragraphs/az_paragraphs_cards/config/install
./modules/custom/az_paragraphs/az_paragraphs_text_background/config/install
./modules/custom/az_paragraphs/az_paragraphs_accordion/config/install
./modules/custom/az_paragraphs/config/install
./modules/custom/az_paragraphs/az_paragraphs_view/config/install
./modules/custom/az_paragraphs/az_paragraphs_text/config/install
./modules/custom/az_paragraphs/az_paragraphs_photo_gallery/config/install
./modules/custom/az_paragraphs/az_paragraphs_contact/config/install
./modules/custom/az_paragraphs/az_paragraphs_text_media/config/install
./modules/custom/az_paragraphs/az_paragraphs_splitscreen/config/install
./modules/custom/az_paragraphs/az_paragraphs_html/config/install
./modules/custom/az_media/config/install
./modules/custom/az_digital_asset_library/config/install
./modules/custom/az_event/config/install
./themes/custom/az_barrio/config/install
./config/optional
./modules/custom/az_person/config/optional
./modules/custom/az_news/config/optional
./modules/custom/az_carousel/config/optional
./modules/custom/az_flexible_page/config/optional
./modules/custom/az_paragraphs/config/optional
./modules/custom/az_event/config/optional
./themes/custom/az_barrio/config/optional
./modules/custom/az_cas/config/quickstart
./modules/custom/az_seo/config/quickstart
./modules/custom/az_carousel/config/quickstart
./modules/custom/az_core/config/quickstart
./modules/custom/az_mail/config/quickstart
./modules/custom/az_security/config/quickstart
./modules/custom/az_digital_asset_library/config/quickstart
trackleft commented 1 year ago

After script is run, simply use git diff to see the differences.

trackleft commented 1 year ago

Could possibly create yet another site in probo (in addition to the migration site) that installs quickstart in stages to compare specific files.

Step 1. Install Quickstart without az_seo and compare all folders (excluding permissions and az_seo config) Step 2. Enable az_seo and compare config in that folder Step 3. Enable all modules and compare permissions config.

Alternatively we can exclude certain config and check it manually, or a combination of both.

trackleft commented 1 year ago

I might also recommend that we remove these config files https://github.com/az-digital/az_quickstart/blob/main/config/install/system.site.yml

And install the required config some other way.

trackleft commented 1 year ago

Updated script First modify the az_quickstart.info.yml to remove az_seo Then Install quickstart Then run this

#!/bin/sh
set -x +e

# Find differences in config
mkdir -p /app/web/profiles/custom/az_quickstart/config/sync
drupal config:export --remove-uuid --remove-config-hash --directory=web/profiles/custom/az_quickstart/config/sync
touch /app/web/profiles/custom/az_quickstart/list-of-config-folders.txt

find /app/web/profiles/custom/az_quickstart/. -type d -name "install" >> /app/web/profiles/custom/az_quickstart/list-of-config-folders.txt
find /app/web/profiles/custom/az_quickstart/. -type d -name "quickstart" >> /app/web/profiles/custom/az_quickstart/list-of-config-folders.txt
find /app/web/profiles/custom/az_quickstart/. -type d -name "optional" >> /app/web/profiles/custom/az_quickstart/list-of-config-folders.txt

while IFS= read -r FOLDER; do
    rsync --exclude 'user.role.*' --exclude 'config/install/system.site.yml' --existing /app/web/profiles/custom/az_quickstart/config/sync/* ${FOLDER}/. </dev/null
done < /app/web/profiles/custom/az_quickstart/list-of-config-folders.txt

rm /app/web/profiles/custom/az_quickstart/list-of-config-folders.txt
drush pm:install az_seo -y
rm -rf /app/web/profiles/custom/az_quickstart/config/sync/.

drupal config:export --remove-uuid --remove-config-hash --directory=web/profiles/custom/az_quickstart/config/sync

rsync  --existing /app/web/profiles/custom/az_quickstart/config/sync/* /app/web/profiles/custom/az_quickstart/modules/custom/az_seo/config/install/.
rsync  --existing /app/web/profiles/custom/az_quickstart/config/sync/* /app/web/profiles/custom/az_quickstart/modules/custom/az_seo/config/quickstart/.
trackleft commented 1 year ago

The script above does not add net new config, only finds changes to existing config.