Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions docs/drupal-issue.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Drupal Issue Picker — DDEV Coder Workspaces</title>
<title>Drupal Core Issue Picker — DDEV Coder Workspaces</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

Expand Down Expand Up @@ -274,12 +275,12 @@
<header>
<a href="/">DDEV Coder Workspaces</a>
<span class="sep">/</span>
<span class="title">Drupal Issue Picker</span>
<span class="title">Drupal Core Issue Picker</span>
</header>

<div class="page">
<h1>Drupal Issue Picker</h1>
<p class="subtitle">Enter a Drupal.org issue URL or number to launch a pre-configured workspace.</p>
<h1>Drupal Core Issue Picker</h1>
<p class="subtitle">Enter a Drupal core issue URL or number to launch a pre-configured workspace.</p>

<div class="input-row">
<input type="text" id="issue-input"
Expand Down Expand Up @@ -448,7 +449,27 @@ <h2>Notes</h2>
'https://git.drupalcode.org/api/v4/projects/' + encodedProject + '/repository/branches?per_page=100'
);
if (branchResp.status === 404) {
setStatus('No issue fork exists for #' + nid + ' yet. To work on this issue, visit the issue page on drupal.org and click "Get push access" to create a fork, then come back here.', 'info');
// Distinguish: issue doesn't exist vs. issue exists but no fork yet
try {
const checkResp = await fetch('https://www.drupal.org/api-d7/node/' + nid + '.json');
if (!checkResp.ok) {
setStatus('Issue #' + nid + ' does not exist on drupal.org. Check the issue number and try again.', 'error');
} else {
// Verify the response is actually a valid node (not a redirect or error page)
let nodeData;
try { nodeData = await checkResp.json(); } catch (_) { nodeData = null; }
const projectName = nodeData && nodeData.field_project && nodeData.field_project.machine_name;
if (!nodeData || String(nodeData.nid) !== String(nid)) {
setStatus('Issue #' + nid + ' does not exist on drupal.org. Check the issue number and try again.', 'error');
} else if (projectName && projectName !== 'drupal') {
setStatus('Issue #' + nid + ' is a ' + projectName + ' issue, not a Drupal core issue. At this time this picker only supports Drupal core.', 'error');
} else {
setStatus('No issue fork exists for #' + nid + ' yet. To work on this issue, visit the issue page on drupal.org and click "Get push access" to create a fork, then come back here.', 'info');
}
}
} catch (_) {
setStatus('Issue #' + nid + ' does not appear to exist on drupal.org. Check the issue number and try again.', 'error');
}
document.getElementById('load-btn').disabled = false;
return;
}
Expand Down Expand Up @@ -486,8 +507,15 @@ <h2>Notes</h2>
const preferred = branches.find(b => b.name.startsWith(nid + '-'));
if (preferred) branchSelect.value = preferred.name;

// Set issue title
document.getElementById('issue-title-text').textContent = '#' + nid + ': ' + title;
// Set issue title with clickable link
const titleEl = document.getElementById('issue-title-text');
titleEl.innerHTML = '';
const issueLink = document.createElement('a');
issueLink.href = 'https://www.drupal.org/project/drupal/issues/' + nid;
issueLink.target = '_blank';
issueLink.textContent = '#' + nid + ': ' + title;
issueLink.style.cssText = 'color: inherit; text-decoration: underline;';
titleEl.appendChild(issueLink);

// Store and display detected Drupal version
currentDrupalMajor = drupalMajor;
Expand Down
1 change: 1 addition & 0 deletions docs/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DDEV Coder Workspaces — Drupal Core Development</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

Expand Down Expand Up @@ -262,8 +263,8 @@ <h2>Drupal issue development</h2>
<div class="template-cards">
<div class="template-card">
<div class="info">
<h3>Drupal Issue Picker</h3>
<p>Enter a Drupal.org issue number — auto-selects branch and launches a workspace with the issue fork checked out</p>
<h3>Drupal Core Issue Picker</h3>
<p>Enter a Drupal.org core issue number — auto-selects branch and launches a workspace with the issue fork checked out</p>
</div>
<a class="btn" href="drupal-issue" style="background:#7c5af0;color:#fff;border-radius:8px;padding:0.6rem 1rem;font-size:0.9rem;font-weight:600;text-decoration:none;white-space:nowrap;">Open Picker</a>
</div>
Expand Down
6 changes: 6 additions & 0 deletions docs/user/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ ddev ssh

The fastest way: use the **[Drupal Issue Picker](https://start.coder.ddev.com/drupal-issue)**. Paste a drupal.org issue URL or bare issue number — it fetches the available branches, lets you pick one, and opens a pre-configured workspace with the issue branch already checked out and all Composer dependencies resolved for that branch.

When working on an issue, the workspace surfaces issue info in several places:

- **Workspace resource page** — the `issue_url` metadata item links directly to the drupal.org issue
- **`~/WELCOME.txt`** — shows the issue number, title, and URL
- **Drupal site name** — set to `#NNNN: issue title` during install (visible in the site header)

To push your changes back:

```bash
Expand Down
160 changes: 101 additions & 59 deletions drupal-core/template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ data "coder_parameter" "issue_branch" {
order = 2
}


data "coder_parameter" "drupal_version" {
name = "drupal_version"
display_name = "Drupal Version"
Expand Down Expand Up @@ -146,7 +147,9 @@ data "coder_workspace_owner" "me" {}
locals {
# Determine workspace home path
# Sysbox Strategy: Use standard /home/coder
workspace_home = "/home/coder"
workspace_home = "/home/coder"
issue_fork_clean = trimprefix(data.coder_parameter.issue_fork.value, "drupal-")
issue_url = local.issue_fork_clean != "" ? "https://www.drupal.org/project/drupal/issues/${local.issue_fork_clean}" : ""
}

locals {
Expand Down Expand Up @@ -310,62 +313,7 @@ resource "coder_agent" "main" {
# Copy files from /home/coder-files to /home/coder
# The volume mount at /home/coder overrides image contents, but /home/coder-files is outside the mount
echo "Copying files from /home/coder-files to ~/..."
if [ -d /home/coder-files ]; then
# Create Drupal-specific welcome message
if [ ! -f ~/WELCOME.txt ]; then
cat > ~/WELCOME.txt << 'WELCOME_EOF'
╔═══════════════════════════════════════════════════════════════╗
║ Welcome to Drupal Core Development ║
╚═══════════════════════════════════════════════════════════════╝
This workspace uses joachim-n/drupal-core-development-project
for a professional Drupal core development setup.
🌐 ACCESS YOUR SITE
Click "DDEV Web" in the Coder dashboard
Or run: ddev launch
🔐 ADMIN CREDENTIALS
Username: admin
Password: admin
One-time link: ddev drush uli
📁 PROJECT STRUCTURE
/home/coder/drupal-core # Project root
/home/coder/drupal-core/repos/drupal # Drupal core git clone
/home/coder/drupal-core/web # Web docroot
🛠️ USEFUL COMMANDS
ddev drush status # Check Drupal status
ddev drush uli # Get admin login link
ddev logs # View container logs
ddev ssh # SSH into web container
ddev describe # Show project details
ddev composer require ... # Add dependencies
📚 DOCUMENTATION
Quickstart: https://github.com/ddev/coder-ddev/blob/main/docs/user/quickstart.md
DDEV: https://docs.ddev.com/
Drupal: https://www.drupal.org/docs
Drupal API: https://api.drupal.org/
Project Template: https://github.com/joachim-n/drupal-core-development-project
📋 SETUP STATUS
~/SETUP_STATUS.txt # Setup completion status
/tmp/drupal-setup.log # Detailed setup logs
💡 TROUBLESHOOTING
If setup failed, check the status and log files above.
You can manually run setup steps from the log.
Good luck with your Drupal core development!
WELCOME_EOF
chown coder:coder ~/WELCOME.txt 2>/dev/null || true
echo "✓ Created Drupal-specific welcome message"
fi
else
if [ ! -d /home/coder-files ]; then
echo "Warning: /home/coder-files not found in image"
fi
Expand Down Expand Up @@ -573,13 +521,89 @@ STATUS_HEADER
ISSUE_FORK="$${ISSUE_FORK#drupal-}" # strip leading "drupal-" if user provided it
ISSUE_BRANCH="${data.coder_parameter.issue_branch.value}"
INSTALL_PROFILE="${data.coder_parameter.install_profile.value}"
# Fetch issue title from drupal.org API at runtime (best-effort; empty string on failure)
ISSUE_TITLE=""
if [ -n "$ISSUE_FORK" ]; then
ISSUE_TITLE=$(curl -sf "https://www.drupal.org/api-d7/node/$${ISSUE_FORK}.json" 2>/dev/null | jq -r '.title // ""' 2>/dev/null || echo "")
fi
USING_ISSUE_FORK=false
SETUP_FAILED=false
if [ -n "$ISSUE_FORK" ] || [ -n "$ISSUE_BRANCH" ]; then
USING_ISSUE_FORK=true
log_setup "Issue fork mode: ISSUE_FORK=$ISSUE_FORK ISSUE_BRANCH=$ISSUE_BRANCH INSTALL_PROFILE=$INSTALL_PROFILE"
fi
# Log issue link early so it's visible at the top of the agent logs
if [ -n "$ISSUE_FORK" ]; then
log_setup "🔗 Issue: https://www.drupal.org/project/drupal/issues/$ISSUE_FORK"
if [ -n "$ISSUE_TITLE" ]; then
log_setup " Title: $ISSUE_TITLE"
fi
fi
# Create Drupal-specific welcome message (first run only, now that issue info is available)
if [ ! -f ~/WELCOME.txt ]; then
{
cat << 'WELCOME_STATIC'
╔═══════════════════════════════════════════════════════════════╗
║ Welcome to Drupal Core Development ║
╚═══════════════════════════════════════════════════════════════╝
This workspace uses joachim-n/drupal-core-development-project
for a professional Drupal core development setup.
🌐 ACCESS YOUR SITE
Click "DDEV Web" in the Coder dashboard
Or run: ddev launch
🔐 ADMIN CREDENTIALS
Username: admin
Password: admin
One-time link: ddev drush uli
📁 PROJECT STRUCTURE
/home/coder/drupal-core # Project root
/home/coder/drupal-core/repos/drupal # Drupal core git clone
/home/coder/drupal-core/web # Web docroot
🛠️ USEFUL COMMANDS
ddev drush status # Check Drupal status
ddev drush uli # Get admin login link
ddev logs # View container logs
ddev ssh # SSH into web container
ddev describe # Show project details
ddev composer require ... # Add dependencies
📚 DOCUMENTATION
Quickstart: https://github.com/ddev/coder-ddev/blob/main/docs/user/quickstart.md
DDEV: https://docs.ddev.com/
Drupal: https://www.drupal.org/docs
Drupal API: https://api.drupal.org/
Project Template: https://github.com/joachim-n/drupal-core-development-project
📋 SETUP STATUS
~/SETUP_STATUS.txt # Setup completion status
/tmp/drupal-setup.log # Detailed setup logs
💡 TROUBLESHOOTING
If setup failed, check the status and log files above.
You can manually run setup steps from the log.
Good luck with your Drupal core development!
WELCOME_STATIC
if [ -n "$ISSUE_FORK" ]; then
echo ""
echo "🐛 WORKING ON ISSUE"
echo " #$${ISSUE_FORK}: $${ISSUE_TITLE}"
echo " https://www.drupal.org/project/drupal/issues/$${ISSUE_FORK}"
fi
} > ~/WELCOME.txt
chown coder:coder ~/WELCOME.txt 2>/dev/null || true
echo "✓ Created Drupal-specific welcome message"
fi
# Step 4: Set up Drupal core project — use seed cache when available (fast path)
# Issue forks skip the cache: the seed composer.json requires "drupal/core: dev-main" and
# vendor is resolved for PHP 8.5/drupal12, both incompatible with non-main issue branches.
Expand Down Expand Up @@ -854,6 +878,16 @@ STATUS_HEADER
# - No issue fork (issue code may differ from cached DB)
# - Install profile is demo_umami (cache was built with that profile)
# - Cache tarball exists
# Compute site name for drush si (used when running a full install)
if [ -n "$ISSUE_FORK" ] && [ -n "$ISSUE_TITLE" ]; then
SITE_NAME="#$${ISSUE_FORK}: $${ISSUE_TITLE}"
elif [ -n "$ISSUE_FORK" ]; then
SITE_NAME="Issue #$${ISSUE_FORK}"
else
SITE_NAME="Drupal Core Development"
fi
if ddev drush status 2>/dev/null | grep -q "Drupal bootstrap.*Successful"; then
log_setup "✓ Drupal already installed"
update_status "✓ Drupal install: Already present"
Expand All @@ -874,7 +908,7 @@ STATUS_HEADER
log_setup "⚠ DB import failed ($((SECONDS - _t))s), falling back to full site install..."
update_status "⚠ DB import failed, running full install..."
_t=$SECONDS
if ddev drush si -y "$INSTALL_PROFILE" --account-pass=admin >> "$SETUP_LOG" 2>&1; then
if ddev drush si -y "$INSTALL_PROFILE" --account-pass=admin --site-name="$SITE_NAME" >> "$SETUP_LOG" 2>&1; then
log_setup "✓ Drupal installed successfully (fallback, $((SECONDS - _t))s)"
update_status "✓ Drupal install: Success (fallback)"
else
Expand All @@ -891,7 +925,7 @@ STATUS_HEADER
fi
update_status "⏳ Drupal install: In progress..."
if ddev drush si -y "$INSTALL_PROFILE" --account-pass=admin >> "$SETUP_LOG" 2>&1; then
if ddev drush si -y "$INSTALL_PROFILE" --account-pass=admin --site-name="$SITE_NAME" >> "$SETUP_LOG" 2>&1; then
log_setup "✓ Drupal installed ($((SECONDS - _t))s)"
log_setup ""
log_setup " Admin Credentials:"
Expand Down Expand Up @@ -1362,6 +1396,14 @@ resource "coder_metadata" "workspace_info" {
key = "image"
value = "${docker_image.workspace_image.name} (version: ${local.image_version})"
}
item {
key = "issue"
value = local.issue_fork_clean != "" ? "#${local.issue_fork_clean}" : "(standard workspace)"
}
item {
key = "issue_url"
value = local.issue_url
}
}

# Output for Vault integration status (visible in Terraform logs)
Expand Down