Skip to content

NW-16007: Add site-level cloud hook examples#62

Open
blkperl wants to merge 4 commits into
acquia:masterfrom
blkperl:worktree-zazzy-wishing-dewdrop
Open

NW-16007: Add site-level cloud hook examples#62
blkperl wants to merge 4 commits into
acquia:masterfrom
blkperl:worktree-zazzy-wishing-dewdrop

Conversation

@blkperl

@blkperl blkperl commented Jun 29, 2026

Copy link
Copy Markdown

Summary

Added new site-level cloud hook examples for pre-site-code-deploy and post-site-code-deploy hooks.

These hooks operate at the site level and receive siteName and extraArgs parameters, enabling customers to:

  • Enable/disable Drupal maintenance mode during site deployments
  • Conditionally run database migrations based on deployment parameters

Changes

New Template Files

  • samples/pre-site-code-deploy.tmpl - Basic template for pre-site-code-deploy hook
  • samples/post-site-code-deploy.tmpl - Basic template for post-site-code-deploy hook

New Example Scripts

  • samples/maintenance-mode-enable.sh - Enables Drupal maintenance mode before site deployment (supports Drupal 7 and 8+)
  • samples/maintenance-mode-disable-and-update.sh - Disables maintenance mode after deployment and optionally runs database updates if triggered via extraArgs

Documentation Updates

  • Updated README.md sample scripts list with new templates and examples
  • Added comprehensive documentation for both hooks in the "Supported hooks" section
  • Included usage examples showing the 8 arguments (including siteName and extraArgs)

Use Cases

Pre-deployment:

# Enable maintenance mode before deployment
cp hooks/samples/maintenance-mode-enable.sh hooks/common/pre-site-code-deploy

Post-deployment:

# Disable maintenance mode and run conditional updates
cp hooks/samples/maintenance-mode-disable-and-update.sh hooks/common/post-site-code-deploy

When deploying via the Cloud UI/API with extraArgs="update-db", the post-hook will automatically run database updates.

Testing

All scripts follow existing patterns and conventions:

  • Executable permissions set on all scripts
  • Consistent argument handling with existing hooks
  • Echo statements for visibility in Cloud UI logs
  • Drush commands follow established patterns

🤖 Generated with Claude Code

blkperl and others added 3 commits June 29, 2026 14:04
Added new cloud hook templates and examples for pre-site-code-deploy and
post-site-code-deploy hooks:

- samples/pre-site-code-deploy.tmpl: Basic template for pre-site-code-deploy
- samples/post-site-code-deploy.tmpl: Basic template for post-site-code-deploy
- samples/maintenance-mode-enable.sh: Enable Drupal maintenance mode before deployment
- samples/maintenance-mode-disable-and-update.sh: Disable maintenance mode and optionally run database updates

Updated README.md with documentation for the new hooks, including:
- Added new samples to the sample scripts list
- Added pre-site-code-deploy section to supported hooks
- Added post-site-code-deploy section to supported hooks

These hooks support site-level deployments with siteName and extraArgs parameters,
enabling customers to manage Drupal maintenance mode and conditional database
updates during deployment.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Created hook directories for pre-site-code-deploy and post-site-code-deploy
in all environments (common, dev, test, prod).

These directories allow customers to place their site-level hook scripts
in the appropriate environment folders, following the same pattern as
existing hooks like post-code-deploy and post-db-copy.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed the example invocations to use "siteName" as a generic parameter
name rather than a specific value like "mysite-prod" to better indicate
this is a variable parameter.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comment thread README.md Outdated
Comment thread README.md Outdated
Co-authored-by: William Van Hevelingen <William.VanHevelingen@acquia.com>
@alexxed alexxed requested a review from janusman June 30, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants