Repository navigation
fix(describe): show service info when project is stopped, fixes #7159 - #7768
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
47ad4cd to
e8240a8
Compare
4c2bebb to
5511c81
Compare
|
Ready for review. I can't imagine how we lived without it 😁. |
| // Ensure we have all services to describe for never-started projects. | ||
| if !fileutil.FileExists(app.DockerComposeFullRenderedYAMLPath()) { | ||
| _ = app.DockerEnv() | ||
| err = app.WriteDockerComposeYAML() | ||
| if err != nil { | ||
| util.Failed("Failed to run `docker-compose config` for '%s': %v", app.Name, err) | ||
| } | ||
| } |
There was a problem hiding this comment.
I added a condition here because PhpStorm DDEV Integration runs ddev describe -j every X seconds.
Running docker-compose config inside app.WriteDockerComposeYAML() every X seconds is not what we want.
|
Should we add it to |
Isn't that the same as I'm not sure we need to add this output to |
|
Well, normally |
…7159 ## The Issue Fixes ddev#7159 When a DDEV project is stopped or has failed containers, `ddev describe` shows empty boxes instead of displaying available service information. The command was overly dependent on `SiteRunning` status, preventing it from showing useful information about configured services when containers aren't running. Additionally, `ddev exec` was checking overall project status instead of verifying the specific target container, causing it to fail when the project had some stopped services even if the target service was running. ## How This PR Solves The Issue **For `ddev describe`:** 1. **Removed status-dependent rendering** (`cmd/ddev/cmd/describe.go`): - Removed the `if status == SiteRunning` check that prevented service table rendering - Service information is now displayed regardless of project status - Individual service status is shown in the table (running/stopped/unhealthy) 2. **Enhanced stopped services data collection** (`pkg/ddevapp/ddevapp.go`): - Added logic to parse docker-compose configuration for stopped services - Extract service information from compose configuration when containers aren't running: - Image names (with `-built` suffix stripped) - Exposed ports from both `ports` section and `HTTP_EXPOSE`/`HTTPS_EXPOSE` environment variables - Virtual hosts and URLs from environment variables - Ensures stopped services have the same data structure as running services 3. **Moved unconditional fields outside status check** (`pkg/ddevapp/ddevapp.go`): - Database info, XHProf mode, and XHGui status now populate regardless of running state - Allows accurate display of configuration even when stopped **For `ddev exec`:** - Changed from checking overall `app.SiteStatus()` to specifically checking if the target container exists using `app.FindContainerByType()` - Provides clearer error messages indicating which specific service is unavailable - Allows exec to work on running services even when other services are stopped ## Manual Testing Instructions ### Test 1: Describe stopped project ```bash cd <any-ddev-project> ddev stop ddev describe # Should show service table with status "stopped" and service details # including exposed ports, virtual hosts, image names ``` ### Test 2: Describe project with failed container ```bash ddev start ddev exec -s db kill 1 ddev describe # Should show db as unhealthy/stopped with service info still visible ``` ### Test 3: Describe running project (regression test) ```bash ddev start ddev describe # Should show full service info as before, with URLs and port mappings ``` ### Test 4: Exec with partial failure ```bash ddev start ddev stop -s db ddev exec ls # Should work - exec targets web service which is still running ddev exec -s db ls # Should fail with clear message: "No running container found for service 'db'" ``` ### Test 5: Services with HTTP_EXPOSE/HTTPS_EXPOSE ```bash # On a project with additional services like adminer or mailpit ddev stop ddev describe # Verify stopped services show correct exposed_ports extracted from environment variables # e.g., adminer should show port 8080 ``` ## Automated Testing Overview Changes impact the `Describe()` method extensively, which is covered by existing tests: - `pkg/ddevapp/ddevapp_test.go` - Tests the `Describe()` method functionality - Tests should pass with these changes as the data structure remains compatible Additional testing should verify: - Stopped project describe output includes service information - Service status accurately reflects container state - Port information correctly extracted from docker-compose environment variables ## Release/Deployment Notes **User-facing improvements:** - `ddev describe` now works when projects are stopped, showing configured services and their settings - More helpful error messages from `ddev exec` when specific services aren't running - Better visibility into project configuration without requiring services to be running **Backwards compatibility:** - Fully backwards compatible - no breaking changes to command output structure - Existing scripts/tools parsing describe output should continue to work - Service data structure remains unchanged, just populated for stopped services **Documentation updates:** - No documentation changes required - this fixes existing documented behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> don't skip optional services in `ddev describe` Describe show work even for fresh never-started project Add x-ddev
5511c81 to
40b9018
Compare
|
I'm not sure what else I might need to change, so I'm going to pull it. There's a bit of duplication of logic, but I don't want to experiment with that before release. |
The Issue
ddev describeshould show info for all available services (including optional profiles) when the project is stopped #7159When a DDEV project is stopped or has failed containers,
ddev describeshows empty boxes instead of displaying available service information. The command was overly dependent onSiteRunningstatus, preventing it from showing useful information about configured services when containers aren't running.Additionally,
ddev execwas checking overall project status instead of verifying the specific target container, causing it to fail when the project had some stopped services even if the target service was running.How This PR Solves The Issue
For
ddev describe:Removed status-dependent rendering (
cmd/ddev/cmd/describe.go):if status == SiteRunningcheck that prevented service table renderingEnhanced stopped services data collection (
pkg/ddevapp/ddevapp.go):-builtsuffix stripped)portssection andHTTP_EXPOSE/HTTPS_EXPOSEenvironment variables - Virtual hosts and URLs from environment variablesMoved unconditional fields outside status check (
pkg/ddevapp/ddevapp.go):For
ddev exec:app.SiteStatus()to specifically checking if the target container exists usingapp.FindContainerByType()Manual Testing Instructions
Test 1: Describe stopped project
Test 2: Describe project with failed container
Test 3: Describe running project (regression test)
ddev start ddev describe # Should show full service info as before, with URLs and port mappingsTest 4: Exec with partial failure
Test 5: Services with HTTP_EXPOSE/HTTPS_EXPOSE
Test 6: Compare
ddev describe -joutput for started and stopped projectAutomated Testing Overview
Changes impact the
Describe()method extensively, which is covered by existing tests:pkg/ddevapp/ddevapp_test.go- Tests theDescribe()method functionalityAdditional testing should verify:
Release/Deployment Notes
User-facing improvements:
ddev describenow works when projects are stopped, showing configured services and their settingsddev execwhen specific services aren't runningBackwards compatibility:
Documentation updates:
🤖 Generated with Claude Code