@@ -85,6 +85,7 @@ data "coder_parameter" "issue_branch" {
8585 order = 2
8686}
8787
88+
8889data "coder_parameter" "drupal_version" {
8990 name = " drupal_version"
9091 display_name = " Drupal Version"
@@ -146,7 +147,9 @@ data "coder_workspace_owner" "me" {}
146147locals {
147148 # Determine workspace home path
148149 # Sysbox Strategy: Use standard /home/coder
149- workspace_home = " /home/coder"
150+ workspace_home = " /home/coder"
151+ issue_fork_clean = trimprefix (data. coder_parameter . issue_fork . value , " drupal-" )
152+ issue_url = local. issue_fork_clean != " " ? " https://www.drupal.org/project/drupal/issues/${ local . issue_fork_clean } " : " "
150153}
151154
152155locals {
@@ -310,62 +313,7 @@ resource "coder_agent" "main" {
310313 # Copy files from /home/coder-files to /home/coder
311314 # The volume mount at /home/coder overrides image contents, but /home/coder-files is outside the mount
312315 echo "Copying files from /home/coder-files to ~/..."
313- if [ -d /home/coder-files ]; then
314-
315-
316- # Create Drupal-specific welcome message
317- if [ ! -f ~/WELCOME.txt ]; then
318- cat > ~/WELCOME.txt << 'WELCOME_EOF'
319- ╔═══════════════════════════════════════════════════════════════╗
320- ║ Welcome to Drupal Core Development ║
321- ╚═══════════════════════════════════════════════════════════════╝
322-
323- This workspace uses joachim-n/drupal-core-development-project
324- for a professional Drupal core development setup.
325-
326- 🌐 ACCESS YOUR SITE
327- Click "DDEV Web" in the Coder dashboard
328- Or run: ddev launch
329-
330- 🔐 ADMIN CREDENTIALS
331- Username: admin
332- Password: admin
333- One-time link: ddev drush uli
334-
335- 📁 PROJECT STRUCTURE
336- /home/coder/drupal-core # Project root
337- /home/coder/drupal-core/repos/drupal # Drupal core git clone
338- /home/coder/drupal-core/web # Web docroot
339-
340- 🛠️ USEFUL COMMANDS
341- ddev drush status # Check Drupal status
342- ddev drush uli # Get admin login link
343- ddev logs # View container logs
344- ddev ssh # SSH into web container
345- ddev describe # Show project details
346- ddev composer require ... # Add dependencies
347-
348- 📚 DOCUMENTATION
349- Quickstart: https://github.com/ddev/coder-ddev/blob/main/docs/user/quickstart.md
350- DDEV: https://docs.ddev.com/
351- Drupal: https://www.drupal.org/docs
352- Drupal API: https://api.drupal.org/
353- Project Template: https://github.com/joachim-n/drupal-core-development-project
354-
355- 📋 SETUP STATUS
356- ~/SETUP_STATUS.txt # Setup completion status
357- /tmp/drupal-setup.log # Detailed setup logs
358-
359- 💡 TROUBLESHOOTING
360- If setup failed, check the status and log files above.
361- You can manually run setup steps from the log.
362-
363- Good luck with your Drupal core development!
364- WELCOME_EOF
365- chown coder:coder ~/WELCOME.txt 2>/dev/null || true
366- echo "✓ Created Drupal-specific welcome message"
367- fi
368- else
316+ if [ ! -d /home/coder-files ]; then
369317 echo "Warning: /home/coder-files not found in image"
370318 fi
371319
@@ -573,13 +521,89 @@ STATUS_HEADER
573521 ISSUE_FORK="$${ISSUE_FORK#drupal-}" # strip leading "drupal-" if user provided it
574522 ISSUE_BRANCH="${ data . coder_parameter . issue_branch . value } "
575523 INSTALL_PROFILE="${ data . coder_parameter . install_profile . value } "
524+
525+ # Fetch issue title from drupal.org API at runtime (best-effort; empty string on failure)
526+ ISSUE_TITLE=""
527+ if [ -n "$ISSUE_FORK" ]; then
528+ ISSUE_TITLE=$(curl -sf "https://www.drupal.org/api-d7/node/$${ISSUE_FORK}.json" 2>/dev/null | jq -r '.title // ""' 2>/dev/null || echo "")
529+ fi
576530 USING_ISSUE_FORK=false
577531 SETUP_FAILED=false
578532 if [ -n "$ISSUE_FORK" ] || [ -n "$ISSUE_BRANCH" ]; then
579533 USING_ISSUE_FORK=true
580534 log_setup "Issue fork mode: ISSUE_FORK=$ISSUE_FORK ISSUE_BRANCH=$ISSUE_BRANCH INSTALL_PROFILE=$INSTALL_PROFILE"
581535 fi
582536
537+ # Log issue link early so it's visible at the top of the agent logs
538+ if [ -n "$ISSUE_FORK" ]; then
539+ log_setup "🔗 Issue: https://www.drupal.org/project/drupal/issues/$ISSUE_FORK"
540+ if [ -n "$ISSUE_TITLE" ]; then
541+ log_setup " Title: $ISSUE_TITLE"
542+ fi
543+ fi
544+
545+ # Create Drupal-specific welcome message (first run only, now that issue info is available)
546+ if [ ! -f ~/WELCOME.txt ]; then
547+ {
548+ cat << 'WELCOME_STATIC'
549+ ╔═══════════════════════════════════════════════════════════════╗
550+ ║ Welcome to Drupal Core Development ║
551+ ╚═══════════════════════════════════════════════════════════════╝
552+
553+ This workspace uses joachim-n/drupal-core-development-project
554+ for a professional Drupal core development setup.
555+
556+ 🌐 ACCESS YOUR SITE
557+ Click "DDEV Web" in the Coder dashboard
558+ Or run: ddev launch
559+
560+ 🔐 ADMIN CREDENTIALS
561+ Username: admin
562+ Password: admin
563+ One-time link: ddev drush uli
564+
565+ 📁 PROJECT STRUCTURE
566+ /home/coder/drupal-core # Project root
567+ /home/coder/drupal-core/repos/drupal # Drupal core git clone
568+ /home/coder/drupal-core/web # Web docroot
569+
570+ 🛠️ USEFUL COMMANDS
571+ ddev drush status # Check Drupal status
572+ ddev drush uli # Get admin login link
573+ ddev logs # View container logs
574+ ddev ssh # SSH into web container
575+ ddev describe # Show project details
576+ ddev composer require ... # Add dependencies
577+
578+ 📚 DOCUMENTATION
579+ Quickstart: https://github.com/ddev/coder-ddev/blob/main/docs/user/quickstart.md
580+ DDEV: https://docs.ddev.com/
581+ Drupal: https://www.drupal.org/docs
582+ Drupal API: https://api.drupal.org/
583+ Project Template: https://github.com/joachim-n/drupal-core-development-project
584+
585+ 📋 SETUP STATUS
586+ ~/SETUP_STATUS.txt # Setup completion status
587+ /tmp/drupal-setup.log # Detailed setup logs
588+
589+ 💡 TROUBLESHOOTING
590+ If setup failed, check the status and log files above.
591+ You can manually run setup steps from the log.
592+
593+ Good luck with your Drupal core development!
594+ WELCOME_STATIC
595+
596+ if [ -n "$ISSUE_FORK" ]; then
597+ echo ""
598+ echo "🐛 WORKING ON ISSUE"
599+ echo " #$${ISSUE_FORK}: $${ISSUE_TITLE}"
600+ echo " https://www.drupal.org/project/drupal/issues/$${ISSUE_FORK}"
601+ fi
602+ } > ~/WELCOME.txt
603+ chown coder:coder ~/WELCOME.txt 2>/dev/null || true
604+ echo "✓ Created Drupal-specific welcome message"
605+ fi
606+
583607 # Step 4: Set up Drupal core project — use seed cache when available (fast path)
584608 # Issue forks skip the cache: the seed composer.json requires "drupal/core: dev-main" and
585609 # vendor is resolved for PHP 8.5/drupal12, both incompatible with non-main issue branches.
@@ -854,6 +878,16 @@ STATUS_HEADER
854878 # - No issue fork (issue code may differ from cached DB)
855879 # - Install profile is demo_umami (cache was built with that profile)
856880 # - Cache tarball exists
881+
882+ # Compute site name for drush si (used when running a full install)
883+ if [ -n "$ISSUE_FORK" ] && [ -n "$ISSUE_TITLE" ]; then
884+ SITE_NAME="#$${ISSUE_FORK}: $${ISSUE_TITLE}"
885+ elif [ -n "$ISSUE_FORK" ]; then
886+ SITE_NAME="Issue #$${ISSUE_FORK}"
887+ else
888+ SITE_NAME="Drupal Core Development"
889+ fi
890+
857891 if ddev drush status 2>/dev/null | grep -q "Drupal bootstrap.*Successful"; then
858892 log_setup "✓ Drupal already installed"
859893 update_status "✓ Drupal install: Already present"
@@ -874,7 +908,7 @@ STATUS_HEADER
874908 log_setup "⚠ DB import failed ($((SECONDS - _t))s), falling back to full site install..."
875909 update_status "⚠ DB import failed, running full install..."
876910 _t=$SECONDS
877- if ddev drush si -y "$INSTALL_PROFILE" --account-pass=admin >> "$SETUP_LOG" 2>&1; then
911+ if ddev drush si -y "$INSTALL_PROFILE" --account-pass=admin --site-name="$SITE_NAME" >> "$SETUP_LOG" 2>&1; then
878912 log_setup "✓ Drupal installed successfully (fallback, $((SECONDS - _t))s)"
879913 update_status "✓ Drupal install: Success (fallback)"
880914 else
@@ -891,7 +925,7 @@ STATUS_HEADER
891925 fi
892926 update_status "⏳ Drupal install: In progress..."
893927
894- if ddev drush si -y "$INSTALL_PROFILE" --account-pass=admin >> "$SETUP_LOG" 2>&1; then
928+ if ddev drush si -y "$INSTALL_PROFILE" --account-pass=admin --site-name="$SITE_NAME" >> "$SETUP_LOG" 2>&1; then
895929 log_setup "✓ Drupal installed ($((SECONDS - _t))s)"
896930 log_setup ""
897931 log_setup " Admin Credentials:"
@@ -1362,6 +1396,14 @@ resource "coder_metadata" "workspace_info" {
13621396 key = " image"
13631397 value = " ${ docker_image . workspace_image . name } (version: ${ local . image_version } )"
13641398 }
1399+ item {
1400+ key = " issue"
1401+ value = local. issue_fork_clean != " " ? " #${ local . issue_fork_clean } " : " (standard workspace)"
1402+ }
1403+ item {
1404+ key = " issue_url"
1405+ value = local. issue_url
1406+ }
13651407}
13661408
13671409# Output for Vault integration status (visible in Terraform logs)
0 commit comments