From 8990a9f160bf2ee4cb6af30bbe47b3a389ad2017 Mon Sep 17 00:00:00 2001 From: Lindsey Catlett Date: Fri, 23 Mar 2018 17:20:05 -0400 Subject: [PATCH 1/5] Backport Hooks to exclude prod and update environments in Cloud Hook scripts. --- scripts/cloud-hooks/functions.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/scripts/cloud-hooks/functions.sh b/scripts/cloud-hooks/functions.sh index d1ea049c5..117ad6401 100644 --- a/scripts/cloud-hooks/functions.sh +++ b/scripts/cloud-hooks/functions.sh @@ -8,10 +8,14 @@ drush_alias=${site}'.'${target_env} deploy_updates() { case $target_env in - 01dev|01test|01live) + 01dev|01test) acsf_deploy ;; - 01devup|01testup|01update) + # Do not run deploy updates on 01live in case a branch is deployed in prod. + 01devup|01testup|01update|01live) + ;; + ode[[:digit:]]*) + deploy_install ;; *) ace_deploy @@ -71,6 +75,24 @@ ace_deploy() { echo "Finished updates for environment: $target_env" } +deploy_sync() { + + echo "Running sync refresh for environment: $target_env" + + # Prep for BLT commands. + repo_root="/var/www/html/$site.$target_env" + export PATH=$repo_root/vendor/bin:$PATH + cd $repo_root + + blt deploy:sync:refresh --define environment=$target_env -v -y + if [ $? -ne 0 ]; then + echo "Sync errored." + exit 1 + fi + + echo "Finished sync for environment: $target_env" +} + deploy_install() { echo "Installing site for environment: $target_env" @@ -87,4 +109,4 @@ deploy_install() { fi echo "Finished installing for environment: $target_env" -} +} \ No newline at end of file From 1fab6be172bda2609b5434b0b5046bb89138d34f Mon Sep 17 00:00:00 2001 From: Lindsey Catlett Date: Sun, 25 Mar 2018 21:14:00 -0400 Subject: [PATCH 2/5] Disable all post-code-deploy cloud hooks on ACSF. --- .../hooks/common/post-code-deploy/post-code-deploy.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/cloud-hooks/hooks/common/post-code-deploy/post-code-deploy.sh b/scripts/cloud-hooks/hooks/common/post-code-deploy/post-code-deploy.sh index 6b4492888..20027a845 100755 --- a/scripts/cloud-hooks/hooks/common/post-code-deploy/post-code-deploy.sh +++ b/scripts/cloud-hooks/hooks/common/post-code-deploy/post-code-deploy.sh @@ -20,9 +20,13 @@ repo_url="$5" repo_type="$6" +acsf_file="/mnt/files/$site.$target_env/files-private/sites.json" +if [ ! -f $acsf_file ]; then . /var/www/html/$site.$target_env/vendor/acquia/blt/scripts/cloud-hooks/functions.sh deploy_updates +fi # Send notifications to Slack, if configured. See readme/deploy.md for setup instructions. . `dirname $0`/../slack.sh + set +v From 9928015a21d39a2b2457f2d7f920542855480648 Mon Sep 17 00:00:00 2001 From: Lindsey Catlett Date: Sun, 25 Mar 2018 21:14:54 -0400 Subject: [PATCH 3/5] Enable BLT integration on ACSF site install and code update with Factory Hooks. --- settings/acsf/db-update/db-update.sh | 25 +++++++++++++++++++++ settings/acsf/post-install/post-install.php | 23 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 settings/acsf/db-update/db-update.sh create mode 100755 settings/acsf/post-install/post-install.php diff --git a/settings/acsf/db-update/db-update.sh b/settings/acsf/db-update/db-update.sh new file mode 100755 index 000000000..b37ac3492 --- /dev/null +++ b/settings/acsf/db-update/db-update.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Factory Hook: db-update +# +# The existence of one or more executable files in the +# /factory-hooks/db-update directory will prompt them to be run *instead of* the +# regular database update (drush updatedb) command. So that update command will +# normally be part of the commands executed below. +# +# Usage: post-code-deploy site env db-role domain custom-arg +# Map the script inputs to convenient names. +# Acquia hosting site / environment names +site="$1" +env="$2" +# database role. (Not expected to be needed in most hook scripts.) +db_role="$3" +# The public domain name of the website. +domain="$4" + +# BLT executable: +blt="/var/www/html/$site.$env/vendor/acquia/blt/bin/blt" + +deployupdate="$blt artifact:update:drupal:all-sites --define environment=$env --define drush.uri=$domain --verbose --yes" + +$deployupdate diff --git a/settings/acsf/post-install/post-install.php b/settings/acsf/post-install/post-install.php new file mode 100755 index 000000000..79f9f0427 --- /dev/null +++ b/settings/acsf/post-install/post-install.php @@ -0,0 +1,23 @@ + Date: Sun, 25 Mar 2018 21:15:30 -0400 Subject: [PATCH 4/5] Backport recommended Factory Hooks for theme refresh and config management. --- settings/acsf/post-settings-php/includes.php | 12 ++++++++++++ .../acsf/post-theme-deploy/clear-twig-cache.sh | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 settings/acsf/post-settings-php/includes.php create mode 100644 settings/acsf/post-theme-deploy/clear-twig-cache.sh diff --git a/settings/acsf/post-settings-php/includes.php b/settings/acsf/post-settings-php/includes.php new file mode 100644 index 000000000..fe8a03593 --- /dev/null +++ b/settings/acsf/post-settings-php/includes.php @@ -0,0 +1,12 @@ +deleteAll();' From c815d594772aea2d917192e2bf16badd0b95b85e Mon Sep 17 00:00:00 2001 From: Lindsey Catlett Date: Mon, 26 Mar 2018 10:59:07 -0400 Subject: [PATCH 5/5] Detect stacks and additional non-standard Acquia environments. --- scripts/cloud-hooks/functions.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/cloud-hooks/functions.sh b/scripts/cloud-hooks/functions.sh index 117ad6401..5a4f750ed 100644 --- a/scripts/cloud-hooks/functions.sh +++ b/scripts/cloud-hooks/functions.sh @@ -7,12 +7,12 @@ drush_alias=${site}'.'${target_env} deploy_updates() { - case $target_env in - 01dev|01test) + case $target_env in + [0-9][1-9](dev|test)) acsf_deploy ;; - # Do not run deploy updates on 01live in case a branch is deployed in prod. - 01devup|01testup|01update|01live) + # Do not run updates on update or live environments. + [0-9][1-9](devup|testup|update)|[0-9][1-9](live)) ;; ode[[:digit:]]*) deploy_install