Skip to content

feat: #553 add AsyncDeploy option for Pantheon review apps via Quicksilver webhook#1211

Open
rabbitlair wants to merge 35 commits into
mainfrom
553--pantheon-review-apps-performance
Open

feat: #553 add AsyncDeploy option for Pantheon review apps via Quicksilver webhook#1211
rabbitlair wants to merge 35 commits into
mainfrom
553--pantheon-review-apps-performance

Conversation

@rabbitlair

@rabbitlair rabbitlair commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Closes #553

Summary

  • Async deploy via Quicksilver: Splits the blocking Pantheon review app job into two separate CI jobs, eliminating up to 10 minutes of idle runner time per PR push. A Quicksilver PHP hook fires a webhook from Pantheon to GitHub/GitLab after code sync completes, triggering a post-deploy job that runs Drush updates and marks the GitHub Deployment as success.
  • Cache Terminus phar: The setup-terminus action now caches the Terminus binary with actions/cache, skipping the download on subsequent runs.
  • PANTHEON_SKIP_WIPE_MULTIDEV for GitLab: GitLab review app jobs now support PANTHEON_SKIP_WIPE_MULTIDEV, matching the existing GitHub behaviour. When set to "true" and the multidev already exists, the delete-and-recreate step is skipped.

Async deploy flow

Job 1 (PR-triggered, ~2–3 min)
  → build → create multidev → git push → exit   [runner released]

[Pantheon syncs code internally]

[Quicksilver fires drainpipe_notify_github.php / drainpipe_notify_gitlab.php]
  → reads secrets from Pantheon Secrets Manager
  → POSTs repository_dispatch to GitHub  /  triggers pipeline on GitLab

Job 2 (webhook-triggered, ~2–3 min)
  → composer install → terminus aliases → drush update → Deployment: success

New opt-in config

// GitHub
"github": { "pantheon": ["ReviewApps", "AsyncDeploy"] }

// GitLab
"gitlab": { "pantheon": ["Deploy", "ReviewApps", "AsyncDeploy"] }

Running composer install after adding AsyncDeploy scaffolds:

  • .github/workflows/PantheonReviewApps.yml — replaced with async variant
  • .github/workflows/PantheonReviewAppsPostDeploy.yml — new post-deploy workflow
  • web/private/scripts/drainpipe_notify_github.php — Quicksilver script (+ GitLab equivalents)

Manual steps required after scaffolding: register the sync_code Quicksilver hook in pantheon.yml and set two Pantheon secrets (drainpipe_github_token, drainpipe_github_repo). Full instructions in the README.

⚠️ GitHub checks behaviour change in async mode

In async mode, Job 2 is triggered by repository_dispatch and does not appear as a PR check. A failed Drush update will not block a merge even if the review app check is required in branch protection. Job 2's result is visible in the GitHub Deployments panel on the PR.

Async deploy observability

The async deploy pipeline introduces a new class of failure that the original implementation left silent: once Job 1 exits, the GitHub Deployment stays in_progress indefinitely if the Pantheon sync fails, if Quicksilver's webhook call is rejected, or if the dispatched Job 2 never starts. To surface these failures, every deployment status update now carries a log_url pointing directly to the CI run that created it — the "View deployment" link in the PR Deployments panel always navigates to the relevant logs regardless of which stage the pipeline is in. When Job 2 starts, it refreshes the in_progress status with its own run URL, so the link stays current as the pipeline hands off between jobs. The Quicksilver scripts also now exit with code 1 on non-2xx HTTP responses, causing Pantheon to record the sync_code workflow as failed rather than silently succeeding when the webhook dispatch is rejected.

For failures that happen entirely outside GitHub's visibility — a Pantheon sync error or a Quicksilver script that fails before firing the dispatch — a new PantheonReviewAppsWatchdog.yml workflow runs on a 30-minute schedule. It scans all GitHub Deployments stuck in in_progress past a configurable threshold (default 20 minutes, overridable via PANTHEON_ASYNC_WATCHDOG_THRESHOLD_MINUTES), queries terminus workflow:list to retrieve the Pantheon sync outcome, and marks each stale deployment error with a diagnostic description identifying whether the Pantheon sync failed, or whether sync succeeded but the post-deploy job never started. The watchdog is scaffolded automatically alongside the other async files when AsyncDeploy is added to composer.json. Job 1 also now writes a step summary to the Actions job page with a direct link to the Pantheon dashboard workflow logs and the terminus workflow:list command, giving developers a clear next step even before the watchdog fires.

Test plan

  • Add "AsyncDeploy" to a test project's composer.json and run composer install — verify the three async files are scaffolded and PantheonReviewApps.yml contains async: 'true'
  • Confirm that ReviewApps without AsyncDeploy is unaffected (blocking workflow unchanged, no post-deploy file)
  • TestPantheonAsyncDeploy.yml CI workflow covers: scaffold file placement (both modes), bash async guards in review/action.yml and update/action.yml, and Quicksilver PHP script pattern filtering + secrets validation
  • Verify Terminus caching works: second run of setup-terminus skips the curl download step
  • Verify PANTHEON_SKIP_WIPE_MULTIDEV=true on GitLab skips multidev wipe on subsequent pushes

@github-actions github-actions Bot requested a deployment to pantheon-pr-1211 April 15, 2026 16:31 In progress

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Introduces asynchronous deployment for Pantheon Review Apps via Quicksilver hooks for GitHub and GitLab and adds PANTHEON_SKIP_WIPE_MULTIDEV to preserve multidev state. Use ln -sf for symbolic links to ensure idempotency. Replace deprecated set-output with $GITHUB_OUTPUT. Remove redundant composer install steps. Quote shell variables to prevent expansion errors.

Comment thread scaffold/github/actions/pantheon/setup-terminus/action.yml Outdated
Comment thread scaffold/github/workflows/PantheonReviewAppsAsync.yml Outdated
Comment thread scaffold/github/workflows/PantheonReviewAppsAsync.yml Outdated
Comment thread scaffold/gitlab/PantheonReviewAppsAsyncJob.gitlab-ci.yml Outdated
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev April 15, 2026 16:40 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev April 16, 2026 18:44 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev April 16, 2026 19:22 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev April 20, 2026 13:34 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev April 20, 2026 14:00 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev April 20, 2026 14:19 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev April 20, 2026 14:51 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev May 28, 2026 18:36 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev May 28, 2026 18:44 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev May 29, 2026 12:21 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev May 29, 2026 14:24 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev May 29, 2026 15:15 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev May 29, 2026 15:54 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev May 29, 2026 17:03 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev May 29, 2026 17:15 Inactive
@github-actions github-actions Bot temporarily deployed to lullabotsandbox.dev May 29, 2026 17:21 Inactive
@rabbitlair rabbitlair force-pushed the 553--pantheon-review-apps-performance branch from b541cae to cad1710 Compare May 29, 2026 17:52
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.

Make PantheonReviewApps more efficient

2 participants