Skip to content

feat: add drupal-contrib template with beta unified issue picker, fixes #59#122

Merged
rfay merged 21 commits intomainfrom
20260506_drupal_contrib
May 6, 2026
Merged

feat: add drupal-contrib template with beta unified issue picker, fixes #59#122
rfay merged 21 commits intomainfrom
20260506_drupal_contrib

Conversation

@rfay
Copy link
Copy Markdown
Member

@rfay rfay commented May 6, 2026

Closes #59. Tracking issue for promoting to production: #121.

What's in this PR

New drupal-contrib Coder template — automated workspace for developing Drupal contrib modules and themes, with optional issue branch support via ddev/ddev-drupal-contrib.

  • Any drupal.org project cloned to /home/coder/{project_name}/
  • Drupal installed as a dev dependency via ddev poser (module/theme auto-symlinked into web root)
  • Issue fork checkout via issue_fork + issue_branch parameters
  • ddev phpunit, ddev phpcs, ddev phpstan available via the addon
  • Mutable share_drupal_site parameter (owner/authenticated/public) on both drupal-contrib and drupal-core
  • drupal-contrib/scripts/test-issue-branches.sh — local/workspace test matrix script
  • .github/workflows/drupal-contrib-integration-test.yml — CI integration test

Picker changes (conservative — production picker untouched)

  • docs/drupal-issue.html — restored to original core-only picker (no change to production behavior)
  • docs/drupal-contrib-picker.html — new unified picker (core + contrib), defaults to staging-coder.ddev.com; BETA badge makes the staging target clear
  • docs/index.html — beta card added alongside the original picker card

Manual testing

1. Template — create a contrib workspace on staging

coder --url https://staging-coder.ddev.com create \
  --template drupal-contrib my-contrib-test \
  --parameter project_name=token \
  --parameter drupal_version=11 \
  --yes

Wait for setup (~5-10 min). Then verify:

  • Workspace reaches running state
  • Drupal site loads (click the Drupal Site app or check port 8080)
  • ddev drush pm:list --status=enabled | grep token returns a result
  • VS Code opens at /home/coder/token

2. Issue fork — check out an issue branch

coder --url https://staging-coder.ddev.com create \
  --template drupal-contrib my-token-issue \
  --parameter project_name=token \
  --parameter drupal_version=11 \
  --parameter issue_fork=3568144 \
  --parameter issue_branch=3568144-fix-something \
  --yes

(Use a real issue number from drupal.org/project/token/issues — the branch name must match an actual branch on the issue fork.)

  • Issue branch is checked out (git branch inside workspace)
  • Module still installs and enables correctly

3. Beta picker — no PR checkout needed

Serve the picker locally from any checkout of this branch:

cd docs && python3 -m http.server 8900
# open http://localhost:8900/drupal-contrib-picker.html
  • Paste a Drupal core issue URL → routes to drupal-core template on staging
  • Paste a contrib issue URL (e.g. drupal.org/project/issues/3456789 for a token issue) → routes to drupal-contrib template on staging
  • Paste a bare project name (token) → opens plain contrib workspace form
  • ?coder=https://coder.ddev.com override works (check the workspace URL in the launched tab)

4. Test matrix script (inside a Coder workspace)

scp drupal-contrib/scripts/test-issue-branches.sh myworkspace.coder:/tmp/
ssh myworkspace.coder bash /tmp/test-issue-branches.sh

Expected: token:11, pathauto:11, token:10 all show PASS in the summary table.

5. Share parameter

On any drupal-core or drupal-contrib workspace:

  • Default sharing is "owner only" (Drupal site URL not publicly accessible)
  • Change parameter to "public", restart workspace → URL becomes publicly accessible

rfay and others added 5 commits May 6, 2026 13:45
fixes #59

- New drupal-contrib Coder template: clones any drupal.org project, installs
  Drupal as a dev dependency via ddev-drupal-contrib addon, enables the module/
  theme, and supports optional issue fork checkout. Uses port 8080.
- Drupal site sharing parameter (owner/authenticated/public, default owner,
  mutable) added to both drupal-contrib and drupal-core templates so developers
  can share a work-in-progress without it being public by default.
- Picker (docs/drupal-issue.html) extended to handle core and contrib: detects
  project type from drupal.org API, routes to the correct template, adds plain
  contrib dev form (no issue), template badges, and ?coder= override for local
  testing against staging.
- Makefile, README.md, docs/index.html, docs/user/quickstart.md updated for
  drupal-contrib.
- CI workflow drupal-contrib-integration-test.yml added (matrix of token/D11
  and pathauto/D11, optional issue-fork job).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Models drupal-core/scripts/test-issue-branches.sh but exercises the
contrib workflow: clone project, optional issue fork checkout, ddev
poser, drush si, module enable, and DB/module status verification.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The ddev config global call was wrong: the startup script inside
a Coder workspace already configures omit-containers, making it
redundant there, and running the script locally would harmfully
overwrite the developer's own global DDEV config.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move the new contrib+core picker to drupal-contrib-picker.html (defaults
to staging-coder.ddev.com so testers hit the right environment).
Restore docs/drupal-issue.html to the original core-only version from main.
Add beta card to docs/index.html linking to the new picker.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rfay
Copy link
Copy Markdown
Member Author

rfay commented May 6, 2026

Testing the beta picker

The htmlpreview link in the original version of this comment does not work — htmlpreview strips <script> tags, so the picker renders but nothing executes.

The picker can be tested after this PR is merged, when GitHub Pages deploys it to:

https://start.coder.ddev.com/drupal-contrib-picker

The picker defaults to staging-coder.ddev.com. You'll need a staging account. Things to try:

  • Paste a Drupal core issue URL → should route to the drupal-core template on staging
  • Paste a contrib issue URL (e.g. any issue under drupal.org/project/token/issues/...) → should route to drupal-contrib template on staging
  • Paste a bare project name (token, pathauto) → should show the plain dev form for contrib
  • Add ?coder=https://coder.ddev.com to the URL to target production instead of staging

Issue #121 tracks the final promotion step: once validated on staging, replace drupal-issue.html with this unified picker and point it at production.

rfay and others added 16 commits May 6, 2026 14:07
mock_data coder_parameter returns value="[]" for all parameters;
"[]" is not a valid coder_app share value. Route through a local
that falls back to "owner" for any unrecognised value so terraform
test plan_succeeds_with_defaults passes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…kflows

New commits on a PR were queuing behind running jobs instead of
cancelling them, blocking the self-hosted sysbox runners. Matches
the pattern already used in integration-test.yml.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
run_id is now 11+ digits causing workspace names to exceed Coder's
32-character limit (e.g. ci-contrib-pathauto-d11-25459356799 = 35
chars). run_number is 3-4 digits and unique per workflow; combined
with run_attempt it remains unique across reruns.

Affects all three integration test workflows.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CONTRIB_TEST_ISSUE_FORK was set to 'token-2648180' but the resolve
step was prepending the project name again, producing token-token-2648180.
Now strips the prefix if present so both '2648180' and 'token-2648180'
work as the repo variable value.

Job title trimmed — the raw variable value in the name template was
being truncated by GitHub when it included the prefixed issue number.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
New mutable parameter has no default that coder create can infer,
so the CLI was prompting interactively and stalling the job.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drupal template changes don't affect user-defined-web or freeform
templates. Skipping saves 2 sysbox runner slots so Drupal integration
tests can start immediately rather than queuing behind unrelated jobs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Old issues (8.x, 9.x era) return an unsupported major version from
field_issue_version. Clamp to 11 so the template parameter validation
doesn't fail. The test issue (CONTRIB_TEST_ISSUE_FORK) should also be
updated to a current D11/D12 issue in the repo variables.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…able log

- Re-add Drupal version clamping (8.x/9.x → 11) lost in file revert
- CI module check: use --format=list + grep -ix for exact machine-name match
- Template: only log '✓ enabled' on actual success; warning was printing
  alongside success message due to unconditional log_setup call

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
field_issue_version for contrib modules is the MODULE version (e.g.
"8.x-1.x" for token module 1.x), not the Drupal core version. Using
it to infer the Drupal core version was fundamentally wrong.

Default to Drupal 11 for issue fork tests. Add CONTRIB_TEST_DRUPAL_VERSION
repo variable override for cases where a different core version is needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…issues

For contrib modules, field_issue_version is the MODULE version (e.g.
8.x-1.x for token module 1.x), not the Drupal core version. Only
apply the version extraction for core issues where field_issue_version
actually contains the Drupal core target (e.g. 11.x-dev).

Also removes the partial band-aid that only caught drupalMajor === 12.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…check race

- Use ddev -p <project> instead of bash -c 'cd && ddev' for all drush steps
- Pass git -C directly to coder ssh without bash -c wrapper
- Move issue-fork branch check to after Drush DB check to avoid race
  with the non-blocking startup script still doing git operations
- Add 'Dump setup status' step (if: always()) to both jobs so SETUP_STATUS.txt
  is visible in CI logs when module enable or other phases fail
- Declare ISSUE_BRANCH/ISSUE_NUMBER/ISSUE_FORK_VERSION in job env block to
  satisfy the GitHub Actions context-access linter
- Document CI scripting rule in CLAUDE.md: no bash -c for nontrivial commands

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ddev has no -p/--project flag. Use 'env -C <dir> ddev drush ...' to set
the working directory without a shell wrapper. Update CLAUDE.md accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Dump last 30 lines of /tmp/drupal-setup.log in the setup-status step
  so we can see enable/cache-rebuild results, not just SETUP_STATUS.txt
- Capture and print the full enabled-modules list before grepping so
  the actual drush output is visible when the check fails
- Switch from grep -ix (full-line exact) to grep -iw (word boundary)
  which handles trailing whitespace or CR in the drush output

Issue-fork branch check is green; this targets the plain module-enabled check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rfay rfay merged commit 6d85160 into main May 6, 2026
15 checks passed
@rfay rfay deleted the 20260506_drupal_contrib branch May 6, 2026 22:51
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.

Add Drupal contrib picker/launcher/scaffolding

1 participant