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
4 changes: 4 additions & 0 deletions .github/workflows/drupal-contrib-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ jobs:
drupal_version: "11"
- project: pathauto
drupal_version: "11"
- project: skipto
drupal_version: "12"
fail-fast: false
defaults:
run:
Expand Down Expand Up @@ -395,6 +397,8 @@ jobs:
drupal_version: "11"
- project: pathauto
drupal_version: "11"
- project: skipto
drupal_version: "12"
fail-fast: false
defaults:
run:
Expand Down
36 changes: 29 additions & 7 deletions drupal-contrib/template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ data "coder_parameter" "drupal_version" {
default = "11"
mutable = true
order = 4
option {
name = "11.x (stable)"
value = "11"
}
option {
name = "12.x (main branch)"
value = "12"
}
option {
name = "11.x (stable)"
value = "11"
}
option {
name = "10.x (stable)"
value = "10"
Expand Down Expand Up @@ -492,6 +492,19 @@ STATUS_HEADER

cd "$PROJ_DIR" || { log_setup "✗ Cannot cd to $PROJ_DIR"; SETUP_FAILED=true; }

# Hide Coder-specific DDEV files from git status.
# .git/info/exclude is never committed and acts like a per-clone .gitignore.
# We only exclude files we generate — not web/, vendor/, etc. which are the
# module's own concern and may already be in its .gitignore.
mkdir -p .git/info
cat > .git/info/exclude << 'GIT_EXCLUDE_EOF'
# Generated by coder-ddev workspace startup — do not edit.
.ddev/.env.web
.ddev/config.coder.yaml
.ddev/docker-compose.coder-describe.yaml
.ddev/config.local.yaml
GIT_EXCLUDE_EOF

# ==========================================
# Phase 3: Issue fork checkout (if requested)
# ==========================================
Expand Down Expand Up @@ -632,6 +645,11 @@ COMPOSE_EOF
update_status "⚠ ddev-drupal-contrib addon: Warning"
fi

# Set DRUPAL_CORE so ddev-drupal-contrib's expand-composer-json / ddev poser
# installs the selected major version instead of defaulting to ^11.
ddev dotenv set .ddev/.env.web --drupal-core "^$DRUPAL_VERSION"
log_setup "✓ DRUPAL_CORE set to ^$DRUPAL_VERSION"

# Start DDEV
ddev poweroff 2>&1 | tee -a "$SETUP_LOG" || true
log_setup "Starting DDEV environment..."
Expand Down Expand Up @@ -663,11 +681,11 @@ COMPOSE_EOF
fi

if [ "$DRUPAL_INSTALLED" = "false" ]; then
# Add drush as require-dev so expand-composer-json includes it in composer.contrib.json
# --no-update avoids triggering plugin checks before Drupal is installed
# Add drush as require-dev so expand-composer-json includes it in composer.contrib.json.
# Direct JSON edit (not `composer require`) per ddev-drupal-contrib README.
log_setup "Adding drush to require-dev..."
update_status "⏳ drush: Adding to composer.json..."
ddev exec composer require --dev drush/drush --no-update --no-interaction >> "$SETUP_LOG" 2>&1 || true
jq '.["require-dev"]["drush/drush"] = "*"' composer.json > composer.json.tmp && mv composer.json.tmp composer.json

# Run ddev poser: expands composer.json → composer.contrib.json (includes require-dev),
# then runs composer install (installs Drupal + drush together), then removes composer.contrib.json
Expand All @@ -677,6 +695,10 @@ COMPOSE_EOF
if ddev poser >> "$SETUP_LOG" 2>&1; then
log_setup "✓ ddev poser complete ($((SECONDS - _t))s)"
update_status "✓ ddev poser: Success"
# Hide the drush require-dev line from git status without touching the
# file — git checkout would remove drush from composer.json and break
# ddev restart (which rebuilds vendor/ from the restored file).
git update-index --skip-worktree composer.json >> "$SETUP_LOG" 2>&1 || true
else
log_setup "✗ ddev poser failed ($((SECONDS - _t))s)"
update_status "✗ ddev poser: Failed"
Expand Down