kanopi / composer-assets-drupal-pantheon
Kanopi deployment configuration for Drupal on Pantheon (CircleCI, Kanopi orbs).
Package info
github.com/kanopi/composer-assets-drupal-pantheon
pkg:composer/kanopi/composer-assets-drupal-pantheon
Requires
- kanopi/composer-assets: ^1.2
README
Important
Read-only mirror. This repository is a subtree split of
kanopi/kanopi-assets and is updated
automatically. Issues are disabled and pull requests are closed automatically —
report issues and open pull requests on the
main kanopi-assets repository.
CircleCI deployment configuration for Drupal on Pantheon, built on the
Kanopi orbs (kanopi/ci-tools, kanopi/cms-updates). Pantheon uses Multidev
for preview/QA, so there is no Tugboat config here.
Scaffolds
| Destination | Update policy | Purpose |
|---|---|---|
.circleci/config.yml |
replaced on update | Full workflow: phpcs/phpstan/rector/twig, deploy→cypress/lighthouse/pa11y/sdtt/backstop, automated-updates, cron |
.circleci/env.sh |
seed once (overwrite:false) |
The per-project fill-in file |
.circleci/scripts/compile-theme.sh |
replaced on update | Theme build (npm/yarn $THEME_BUILD_COMMAND), in place — runs in the deploy job before the Pantheon artifact is built |
.circleci/scripts/pantheon/dev-multidev |
replaced on update | Pantheon dev/multidev deploy |
.circleci/scripts/pantheon/pre-deploy.sh |
seed once (overwrite:false) |
Optional CI hook, runs before the artifact push (ships empty) |
.circleci/scripts/pantheon/post-deploy.sh |
seed once (overwrite:false) |
Optional CI hook, runs after the release tasks (ships empty) |
{web/private,private}/scripts/quicksilver/drush-deploy.php |
seed once (overwrite:false) |
Quicksilver hook: drush deploy after a platform deploy |
{web/private,private}/scripts/quicksilver/new_relic_deploy.php |
seed once (overwrite:false) |
Quicksilver hook: record the deploy in New Relic |
pantheon.yml |
seed once (overwrite:false) |
Platform config + Quicksilver deploy hooks (skipped if you already have one) |
The Quicksilver scripts and pantheon.yml are placed by composer-assets
conditional mapping: under web/private/ when a web/ docroot exists, else
private/ — and the matching pantheon.yml variant (web_docroot: true vs not)
is seeded with paths to match. No deploy-time staging.
The logic lives in the orbs and the shipped files; per-project values live only
in env.sh. Bump the orb version or update this package to roll a fix to
every site. To diverge, a site sets ".circleci/config.yml": false (or the
script path) in its own composer.json and commits its own copy.
Fill in .circleci/env.sh
TERMINUS_SITE, PANTHEON_UUID, DEFAULT_BRANCH, DOCROOT, THEME_NAME,
THEME_PATH, NODE_VERSION, NODE_PACKAGE_MANAGER (npm/yarn). The PHP
version is a pipeline parameter at the top of config.yml (the docker image
resolves before env.sh can be sourced); Node is installed at runtime via
nvm, so NODE_VERSION lives in env.sh.
Deploy hooks
pre-deploy.sh and post-deploy.sh (seeded once, committed, yours to edit)
let you customize the deploy without forking dev-multidev. They ship empty and
run only if present — pre-deploy.sh before the artifact is pushed,
post-deploy.sh after the release tasks (drush deploy + cache clear), with
$TERMINUS_SITE.$TERMINUS_ENV in scope and terminus authenticated.
These are CI-side hooks (CircleCI deploys to dev/multidev). For platform deploys (dev→test→live promotions), see Quicksilver below.
Quicksilver hooks
pantheon.yml registers workflows.deploy.after hooks that run on Pantheon
after every code deploy — including dashboard promotions that never touch CI:
drush-deploy.php— runsdrush deploy(db updates, cache rebuild, config import, deploy hooks) on the deployed environment.new_relic_deploy.php— records a deploy marker in New Relic. Requires the site secret:terminus secret:site:set <site> new_relic_api_key <key>.
composer-assets seeds both scripts and pantheon.yml under web/private/ when a
web/ docroot exists, else private/ (conditional mapping on exists: web), so
the hook paths always resolve and the scripts ship in the committed artifact —
no deploy-time staging. If your project already has a pantheon.yml, the
seeded one is skipped — copy its workflows block in by hand.
Toggling stages
- Theme build — set
BUILD_THEME="false"inenv.shfor a theme-less / no-build site (compile-theme.shthen skips the build; it also auto-skips when the theme has nopackage.json). - Post-deploy jobs —
config.ymlexposes boolean pipeline parameters (run_cypress,run_lighthouse,run_pa11y,run_sdtt,run_backstop), all defaulttrue. Flip a default tofalseto skip that job. These are jobs, not steps, so they live inconfig.yml, notenv.sh— CircleCI resolves the workflow beforeenv.shis sourced.
Secrets (CircleCI kanopi-code context — never in the repo)
TERMINUS_TOKEN, GITHUB_TOKEN, DOCKERHUB_USER, DOCKERHUB_PASS,
SLACK_WEBHOOK. Add the deploy SSH key under Project Settings → SSH Keys.
Scheduled pipelines
- automatic updates — name a CircleCI scheduled trigger
automatic updates. - cron job … — name a trigger starting with
cron job; set thecron_envpipeline parameter to the target Pantheon env.
Code quality (PHPStan, Rector, Twig CS Fixer)
phpstan.neon, rector.php, and .twig-cs-fixer.php are seeded once
(overwrite:false) at the repo root — yours to tune, modeled on
kanopi/drupal-starter. They're
docroot-agnostic: the scan paths live in the composer scripts, not the configs.
The configs only run once your project composer.json has the tools and the
scripts the CI invokes (code-sniff-ci, phpstan-ci, rector-modules-ci,
rector-themes-ci, twig-lint-ci). Copy those scripts from drupal-starter (scan
paths under web/modules/custom and web/themes/custom) and add:
"require-dev": { "drupal/coder": "^8.3", "mglaman/phpstan-drupal": "^2.0", "palantirnet/drupal-rector": "^0.21.0", "vincentlanglet/twig-cs-fixer": "^3" }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, "phpstan/extension-installer": true } }