From ac5043ed5c561388ea547e75f267ff5b37fa3de4 Mon Sep 17 00:00:00 2001 From: William Vanhevelingen Date: Mon, 29 Jun 2026 15:09:34 -0700 Subject: [PATCH 1/2] NW-16019: Add new hook directories and examples Added support for four new Acquia Cloud hooks: - pre-site-wipe: Hook that runs before a site is wiped - post-site-wipe: Hook that runs after a site is wiped - post-site-instance-duplicate: Hook that runs after a site instance is duplicated - post-site-associate: Hook that runs after a site is associated with an environment Created: - Hook directories for each environment (common/dev/test/prod) - Sample template scripts in samples/ directory - Documentation in README.md for all new hooks Co-Authored-By: Claude Sonnet 4.5 --- README.md | 41 +++++++++++++++++++++++ samples/post-site-associate.tmpl | 14 ++++++++ samples/post-site-instance-duplicate.tmpl | 15 +++++++++ samples/post-site-wipe.tmpl | 14 ++++++++ samples/pre-site-wipe.tmpl | 14 ++++++++ 5 files changed, 98 insertions(+) create mode 100755 samples/post-site-associate.tmpl create mode 100755 samples/post-site-instance-duplicate.tmpl create mode 100755 samples/post-site-wipe.tmpl create mode 100755 samples/pre-site-wipe.tmpl diff --git a/README.md b/README.md index c32f9a7..a651d6e 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,10 @@ Sample scripts currently include: * post-code-update.tmpl: Template for post-code-update hook scripts. * post-db-copy.tmpl: Template for post-db-copy hook scripts. * post-files-copy.tmpl: Template for post-files-copy hook scripts. +* pre-site-wipe.tmpl: Template for pre-site-wipe hook scripts. +* post-site-wipe.tmpl: Template for post-site-wipe hook scripts. +* post-site-instance-duplicate.tmpl: Template for post-site-instance-duplicate hook scripts. +* post-site-associate.tmpl: Template for post-site-associate hook scripts. * update-db.sh: Run drush updatedb to perform database updates. * db-scrub.sh: Scrub important information from a Drupal database. * drupal-tests.sh: Run Drupal simpletests. @@ -156,3 +160,40 @@ Usage: post-files-copy site target-env source-env Example: When you use the Workflow page to drag files from Prod to Dev, the files-copy hook will be run like: post-files-copy mysite prod dev + +### pre-site-wipe + +The pre-site-wipe hook is run before a site's database and files are wiped from an environment. This allows you to perform backups or other preparatory actions before the site data is removed. + +Usage: pre-site-wipe site target-env + +* site: The site name. This is the same as the Acquia Cloud username for the site. +* target-env: The environment from which the site will be wiped. + +### post-site-wipe + +The post-site-wipe hook is run after a site's database and files have been wiped from an environment. This allows you to perform cleanup, notifications, or initialization of a fresh environment. + +Usage: post-site-wipe site target-env + +* site: The site name. This is the same as the Acquia Cloud username for the site. +* target-env: The environment from which the site was wiped. + +### post-site-instance-duplicate + +The post-site-instance-duplicate hook is run after a site instance has been duplicated to create a new environment. This allows you to perform post-duplication configuration, data scrubbing, or environment-specific setup. + +Usage: post-site-instance-duplicate site target-env source-env + +* site: The site name. This is the same as the Acquia Cloud username for the site. +* target-env: The environment that was created from the duplication. +* source-env: The environment from which the site was duplicated. + +### post-site-associate + +The post-site-associate hook is run after a site has been associated with an environment. This allows you to perform initialization tasks, configure environment-specific settings, or set up integrations. + +Usage: post-site-associate site target-env + +* site: The site name. This is the same as the Acquia Cloud username for the site. +* target-env: The environment with which the site was associated. diff --git a/samples/post-site-associate.tmpl b/samples/post-site-associate.tmpl new file mode 100755 index 0000000..af22d3b --- /dev/null +++ b/samples/post-site-associate.tmpl @@ -0,0 +1,14 @@ +#!/bin/sh +# +# Cloud Hook: post-site-associate +# +# The post-site-associate hook is run after a site has been associated with +# an environment. This allows you to perform initialization tasks, configure +# environment-specific settings, or set up integrations. +# +# Usage: post-site-associate site target-env + +site="$1" +target_env="$2" + +echo "$site.$target_env: Site associated with environment." diff --git a/samples/post-site-instance-duplicate.tmpl b/samples/post-site-instance-duplicate.tmpl new file mode 100755 index 0000000..6952766 --- /dev/null +++ b/samples/post-site-instance-duplicate.tmpl @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Cloud Hook: post-site-instance-duplicate +# +# The post-site-instance-duplicate hook is run after a site instance has been +# duplicated to create a new environment. This allows you to perform +# post-duplication configuration, data scrubbing, or environment-specific setup. +# +# Usage: post-site-instance-duplicate site target-env source-env + +site="$1" +target_env="$2" +source_env="$3" + +echo "$site.$target_env: Site instance duplicated from $source_env." diff --git a/samples/post-site-wipe.tmpl b/samples/post-site-wipe.tmpl new file mode 100755 index 0000000..ecf269d --- /dev/null +++ b/samples/post-site-wipe.tmpl @@ -0,0 +1,14 @@ +#!/bin/sh +# +# Cloud Hook: post-site-wipe +# +# The post-site-wipe hook is run after a site's database and files have been +# wiped from an environment. This allows you to perform cleanup, notifications, +# or initialization of a fresh environment. +# +# Usage: post-site-wipe site target-env + +site="$1" +target_env="$2" + +echo "$site.$target_env: Site wipe completed." diff --git a/samples/pre-site-wipe.tmpl b/samples/pre-site-wipe.tmpl new file mode 100755 index 0000000..50e4ef5 --- /dev/null +++ b/samples/pre-site-wipe.tmpl @@ -0,0 +1,14 @@ +#!/bin/sh +# +# Cloud Hook: pre-site-wipe +# +# The pre-site-wipe hook is run before a site's database and files are wiped +# from an environment. This allows you to perform backups or other preparatory +# actions before the site data is removed. +# +# Usage: pre-site-wipe site target-env + +site="$1" +target_env="$2" + +echo "$site.$target_env: Preparing for site wipe." From 998f38ccf23ee48e796042352ba8825e31db30b3 Mon Sep 17 00:00:00 2001 From: William Vanhevelingen Date: Mon, 29 Jun 2026 15:15:16 -0700 Subject: [PATCH 2/2] NW-16019: Fix hook argument names in templates and documentation Corrected the hook parameters based on the actual implementation in environment-service-go: - Changed 'site' to 'app-name' (application name) - Changed 'target-env' to 'stage' (dev/test/prod) - Updated post-site-instance-duplicate to use 'source-site-name' - Updated post-site-associate to include 'site-name' parameter These changes match how the hooks are actually invoked by the cloud-hooks.sh script in the environment-service-go repository. Co-Authored-By: Claude Sonnet 4.5 --- README.md | 27 ++++++++++++----------- samples/post-site-associate.tmpl | 9 ++++---- samples/post-site-instance-duplicate.tmpl | 10 ++++----- samples/post-site-wipe.tmpl | 8 +++---- samples/pre-site-wipe.tmpl | 8 +++---- 5 files changed, 32 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index a651d6e..e1f7cbb 100644 --- a/README.md +++ b/README.md @@ -165,35 +165,36 @@ Example: When you use the Workflow page to drag files from Prod to Dev, the file The pre-site-wipe hook is run before a site's database and files are wiped from an environment. This allows you to perform backups or other preparatory actions before the site data is removed. -Usage: pre-site-wipe site target-env +Usage: pre-site-wipe app-name stage -* site: The site name. This is the same as the Acquia Cloud username for the site. -* target-env: The environment from which the site will be wiped. +* app-name: The application name for the site. +* stage: The environment stage (dev, test, or prod) from which the site will be wiped. ### post-site-wipe The post-site-wipe hook is run after a site's database and files have been wiped from an environment. This allows you to perform cleanup, notifications, or initialization of a fresh environment. -Usage: post-site-wipe site target-env +Usage: post-site-wipe app-name stage -* site: The site name. This is the same as the Acquia Cloud username for the site. -* target-env: The environment from which the site was wiped. +* app-name: The application name for the site. +* stage: The environment stage (dev, test, or prod) from which the site was wiped. ### post-site-instance-duplicate The post-site-instance-duplicate hook is run after a site instance has been duplicated to create a new environment. This allows you to perform post-duplication configuration, data scrubbing, or environment-specific setup. -Usage: post-site-instance-duplicate site target-env source-env +Usage: post-site-instance-duplicate app-name stage source-site-name -* site: The site name. This is the same as the Acquia Cloud username for the site. -* target-env: The environment that was created from the duplication. -* source-env: The environment from which the site was duplicated. +* app-name: The application name for the target site. +* stage: The environment stage (dev, test, or prod) of the target environment. +* source-site-name: The name of the source site that was duplicated. ### post-site-associate The post-site-associate hook is run after a site has been associated with an environment. This allows you to perform initialization tasks, configure environment-specific settings, or set up integrations. -Usage: post-site-associate site target-env +Usage: post-site-associate app-name stage site-name -* site: The site name. This is the same as the Acquia Cloud username for the site. -* target-env: The environment with which the site was associated. +* app-name: The application name for the site. +* stage: The environment stage (dev, test, or prod) with which the site was associated. +* site-name: The name of the site that was associated. diff --git a/samples/post-site-associate.tmpl b/samples/post-site-associate.tmpl index af22d3b..4d9d6e7 100755 --- a/samples/post-site-associate.tmpl +++ b/samples/post-site-associate.tmpl @@ -6,9 +6,10 @@ # an environment. This allows you to perform initialization tasks, configure # environment-specific settings, or set up integrations. # -# Usage: post-site-associate site target-env +# Usage: post-site-associate app-name stage site-name -site="$1" -target_env="$2" +app_name="$1" +stage="$2" +site_name="$3" -echo "$site.$target_env: Site associated with environment." +echo "$app_name.$stage: Site $site_name associated with environment." diff --git a/samples/post-site-instance-duplicate.tmpl b/samples/post-site-instance-duplicate.tmpl index 6952766..d5b54a8 100755 --- a/samples/post-site-instance-duplicate.tmpl +++ b/samples/post-site-instance-duplicate.tmpl @@ -6,10 +6,10 @@ # duplicated to create a new environment. This allows you to perform # post-duplication configuration, data scrubbing, or environment-specific setup. # -# Usage: post-site-instance-duplicate site target-env source-env +# Usage: post-site-instance-duplicate app-name stage source-site-name -site="$1" -target_env="$2" -source_env="$3" +app_name="$1" +stage="$2" +source_site_name="$3" -echo "$site.$target_env: Site instance duplicated from $source_env." +echo "$app_name.$stage: Site instance duplicated from $source_site_name." diff --git a/samples/post-site-wipe.tmpl b/samples/post-site-wipe.tmpl index ecf269d..dd0a81a 100755 --- a/samples/post-site-wipe.tmpl +++ b/samples/post-site-wipe.tmpl @@ -6,9 +6,9 @@ # wiped from an environment. This allows you to perform cleanup, notifications, # or initialization of a fresh environment. # -# Usage: post-site-wipe site target-env +# Usage: post-site-wipe app-name stage -site="$1" -target_env="$2" +app_name="$1" +stage="$2" -echo "$site.$target_env: Site wipe completed." +echo "$app_name.$stage: Site wipe completed." diff --git a/samples/pre-site-wipe.tmpl b/samples/pre-site-wipe.tmpl index 50e4ef5..7cbdcd3 100755 --- a/samples/pre-site-wipe.tmpl +++ b/samples/pre-site-wipe.tmpl @@ -6,9 +6,9 @@ # from an environment. This allows you to perform backups or other preparatory # actions before the site data is removed. # -# Usage: pre-site-wipe site target-env +# Usage: pre-site-wipe app-name stage -site="$1" -target_env="$2" +app_name="$1" +stage="$2" -echo "$site.$target_env: Preparing for site wipe." +echo "$app_name.$stage: Preparing for site wipe."