Skip to content

refactor: use ddev composer create-project in the code, for #6920 - #7027

Merged
rfay merged 4 commits into
mainfrom
20250227_stasadev_composer_create_project
Mar 5, 2025
Merged

rfay merged 4 commits into
mainfrom
20250227_stasadev_composer_create_project

Conversation

@stasadev

@stasadev stasadev commented Feb 26, 2025 •

Copy link
Copy Markdown
Member

The Issue

43% of people are already using v1.24.2 and we expect more people to upgrade to v1.24.3.

https://app.amplitude.com/analytics/share/a0fde21314e34378831943af7f9dd022

How This PR Solves The Issue

Hides ddev composer create from autocompletion and ddev help composer.
Adds ddev composer create-project to autocompletion and ddev help composer.

Replaces this in the code (excluding quickstarts):

-ddev composer create vendor/package:^a.b
+ddev composer create-project vendor/package . "^a.b"

Adds exclusions for ".idea", ".vscode" in addition to ".ddev", ".git", ".tarballs".

Manual Testing Instructions

Automated tests should just pass.

Automated Testing Overview

Release/Deployment Notes

@github-actions

github-actions Bot commented Feb 26, 2025 •

Copy link
Copy Markdown

@stasadev
stasadev marked this pull request as ready for review February 27, 2025 08:46
@stasadev
stasadev requested review from a team as code owners February 27, 2025 08:46
@rfay

rfay commented Feb 27, 2025

Copy link
Copy Markdown
Member

I know this is 100% great but it touches so many things I'll have to spend a little time with it.

@ChloeSartorelli

Copy link
Copy Markdown
Contributor

The "solution" section of the linked issue starts

After most people use DDEV v1.24.2+, we can make the following changes

Is 43% enough? I'm worried that over half of users are still on earlier versions.

@stasadev

stasadev commented Feb 28, 2025 •

Copy link
Copy Markdown
Member Author

I can update everything for now without touching quickstart.md (and its tests), if that makes sense.

This way, it will be an easy switch in the future, allowing us to make changes step by step.

@stasadev
stasadev force-pushed the 20250227_stasadev_composer_create_project branch from 63e7e99 to 4b093d6 Compare February 28, 2025 13:55
@stasadev stasadev changed the title refactor: use ddev composer create-project everywhere, fixes #6920 refactor: use ddev composer create-project in the code, for #6920 Feb 28, 2025
@stasadev

Copy link
Copy Markdown
Member Author

Thanks, @GuySartorelli!

The changes made here should be easy to understand now, and it will be much simpler to update our quickstarts later without needing to review a massive PR.

@rfay

rfay commented Feb 28, 2025

Copy link
Copy Markdown
Member

And note that the changes to the quickstart don't go to "stable", the only place we expect them to show up, until the next release (late March, hopefully).

Today's situation: https://app.amplitude.com/analytics/share/a0fde21314e34378831943af7f9dd022

@ChloeSartorelli ChloeSartorelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

@rfay
rfay merged commit 6999cbc into main Mar 5, 2025
@rfay
rfay deleted the 20250227_stasadev_composer_create_project branch March 5, 2025 17:36
stasadev added a commit to stasadev/ddev that referenced this pull request Oct 7, 2026
…hand

## Short Summary (TL;DR)

The all-project-types job is the only CI job that runs tests with `GOTEST_SHORT` unset, and it ran a hand-kept list that had fallen behind, so 16 tests that skip or shrink under `GOTEST_SHORT` never ran in full anywhere. The list is now generated from the tests themselves, so it can't fall behind again.

## The Issue

Found while working on ddev#7904, which changes `TestDebugRebuildCmd`: CI logs show `--- SKIP: TestDebugRebuildCmd` in every job, because Buildkite and `test-reusable.yml` set `GOTEST_SHORT=16` and apache-fpm sets `5`.

The list came from ddev#6693 and broke in three ways:

- ddev#7027 renamed `TestComposerCreateCmd` to `TestComposerCreateProjectCmd`, so that entry has matched nothing since.
- ddev#8028 added `GOTEST_SHORT` skips to `TestDebugRebuildCmd`, `TestDdevImportDB`, `TestDdevRestoreSnapshot`, `TestProcessHooks`, and `TestWebserverMariaMySQLDBClient`, and later PRs did the same for `TestEphemeralPortsReusedOnRestart` (ddev#7992), `TestRouterPortSubstitutionPersistsAcrossProjects` (ddev#8653), `TestSnapshotUncompressed` (ddev#8704), `TestDebugDeleteVolumeCmd` (ddev#8756), and `TestDdevExportDB` (ddev#8798), none of them updating the list.
- `TestComposerVersionConfig`, `TestHttpsRedirection`, `TestMysqlCommand`, `TestDdevStartMultipleHostnames`, and `TestProjectAutocompletionForExecCmd` already did less under `GOTEST_SHORT` when ddev#6693 wrote the list, and weren't on it.

## How This PR Solves The Issue

Tests use three `testcommon` helpers instead of reading `GOTEST_SHORT`: `SkipIfGotestShort(t)`, `IsGotestShort(t)`, and `UsesAllTestSites(t)`, a marker for tests that loop over every test site. `.github/workflows/all-project-types-tests.sh` finds the tests that call them and prints the `-run` pattern, and fails if a test other than `TestMain` reads `GOTEST_SHORT` itself.

The pattern is anchored, so prefix matches such as every `TestCmdStart*` test or `TestAutocompleteServiceForServiceFlag` no longer ride along; like `TestAppdirAlreadyInUse` and `TestConfigValidate`, which also leave the list, they don't depend on `GOTEST_SHORT` and run in every job. The `GOTEST_SHORT` branches that ddev#8028 made unreachable in `TestComposerCreateProjectCmd` and `TestDdevAllDatabases` are removed.

## Manual Testing Instructions

```bash
.github/workflows/all-project-types-tests.sh
# Expect ^(TestAutocompletionForDescribeCmd|...|TestWriteDrushConfig)\b with the 42 tests below
```

Adding `if os.Getenv("GOTEST_SHORT") != "" { t.Skip() }` to any test makes the script print that file and line and exit non-zero.

## Automated Testing Overview

In the all-project-types job, the "Compute TESTARGS" step of `prepare-testargs` should print a `-run '^(...)\b'` pattern with exactly these 42 tests, and the test log should show each of them running, none skipped because of `GOTEST_SHORT`:

```text
TestAutocompletionForDescribeCmd TestAutocompletionForStartCmd TestAutocompletionForStopCmd
TestAvailableUpdates TestCmdDescribe TestCmdDescribeAppFunction TestCmdDescribeAppUsingSitename
TestCmdList TestCmdStart TestCmdStop TestComposerCreateProjectCmd TestComposerVersionConfig
TestConfigDatabaseVersion TestDdevAllDatabases TestDdevExportDB TestDdevFullSiteSetup
TestDdevImportDB TestDdevImportFiles TestDdevImportFilesCustomUploadDir TestDdevImportFilesDir
TestDdevRestoreSnapshot TestDdevStartMultipleHostnames TestDdevUploadDirNoPackage
TestDdevXdebugEnabled TestDdevXhprofPrependEnabled TestDdevXhprofXhguiEnabled
TestDebugDeleteVolumeCmd TestDebugRebuildCmd TestEphemeralPortsReusedOnRestart TestGetApps
TestGetAppsEmpty TestHardenedStart TestHttpsRedirection TestMysqlCommand TestPHPConfig
TestPHPWebserverType TestProcessHooks TestProjectAutocompletionForExecCmd
TestRouterPortSubstitutionPersistsAcrossProjects TestSnapshotUncompressed
TestWebserverMariaMySQLDBClient TestWriteDrushConfig
```

Some of the 16 tests that never ran in full may fail after being skipped this long; this PR's run is where that should show up.

🤖 Developed with assistance from [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
stasadev added a commit to stasadev/ddev that referenced this pull request Oct 8, 2026
…hand

## Short Summary (TL;DR)

The all-project-types job is the only CI job that runs tests with `GOTEST_SHORT` unset, and it ran a hand-kept list that had fallen behind, so 16 tests that skip or shrink under `GOTEST_SHORT` never ran in full anywhere. The list is now generated from the tests themselves, so it can't fall behind again.

## The Issue

Found while working on ddev#7904, which changes `TestDebugRebuildCmd`: CI logs show `--- SKIP: TestDebugRebuildCmd` in every job, because Buildkite and `test-reusable.yml` set `GOTEST_SHORT=16` and apache-fpm sets `5`.

The list came from ddev#6693 and broke in three ways:

- ddev#7027 renamed `TestComposerCreateCmd` to `TestComposerCreateProjectCmd`, so that entry has matched nothing since.
- ddev#8028 added `GOTEST_SHORT` skips to `TestDebugRebuildCmd`, `TestDdevImportDB`, `TestDdevRestoreSnapshot`, `TestProcessHooks`, and `TestWebserverMariaMySQLDBClient`, and later PRs did the same for `TestEphemeralPortsReusedOnRestart` (ddev#7992), `TestRouterPortSubstitutionPersistsAcrossProjects` (ddev#8653), `TestSnapshotUncompressed` (ddev#8704), `TestDebugDeleteVolumeCmd` (ddev#8756), and `TestDdevExportDB` (ddev#8798), none of them updating the list.
- `TestComposerVersionConfig`, `TestHttpsRedirection`, `TestMysqlCommand`, `TestDdevStartMultipleHostnames`, and `TestProjectAutocompletionForExecCmd` already did less under `GOTEST_SHORT` when ddev#6693 wrote the list, and weren't on it.

## How This PR Solves The Issue

Tests use three `testcommon` helpers instead of reading `GOTEST_SHORT`: `SkipIfGotestShort(t)`, `IsGotestShort(t)`, and `UsesAllTestSites(t)`, a marker for tests that loop over every test site. `.github/workflows/all-project-types-tests.sh` finds the tests that call them and prints the `-run` pattern, and fails if a test other than `TestMain` reads `GOTEST_SHORT` itself.

The pattern is anchored, so prefix matches such as every `TestCmdStart*` test or `TestAutocompleteServiceForServiceFlag` no longer ride along; like `TestAppdirAlreadyInUse` and `TestConfigValidate`, which also leave the list, they don't depend on `GOTEST_SHORT` and run in every job. The `GOTEST_SHORT` branches that ddev#8028 made unreachable in `TestComposerCreateProjectCmd` and `TestDdevAllDatabases` are removed.

## Manual Testing Instructions

```bash
.github/workflows/all-project-types-tests.sh
# Expect ^(TestAutocompletionForDescribeCmd|...|TestWriteDrushConfig)\b with the 42 tests below
```

Adding `if os.Getenv("GOTEST_SHORT") != "" { t.Skip() }` to any test makes the script print that file and line and exit non-zero.

## Automated Testing Overview

In the all-project-types job, the "Compute TESTARGS" step of `prepare-testargs` should print a `-run '^(...)\b'` pattern with exactly these 42 tests, and the test log should show each of them running, none skipped because of `GOTEST_SHORT`:

```text
TestAutocompletionForDescribeCmd TestAutocompletionForStartCmd TestAutocompletionForStopCmd
TestAvailableUpdates TestCmdDescribe TestCmdDescribeAppFunction TestCmdDescribeAppUsingSitename
TestCmdList TestCmdStart TestCmdStop TestComposerCreateProjectCmd TestComposerVersionConfig
TestConfigDatabaseVersion TestDdevAllDatabases TestDdevExportDB TestDdevFullSiteSetup
TestDdevImportDB TestDdevImportFiles TestDdevImportFilesCustomUploadDir TestDdevImportFilesDir
TestDdevRestoreSnapshot TestDdevStartMultipleHostnames TestDdevUploadDirNoPackage
TestDdevXdebugEnabled TestDdevXhprofPrependEnabled TestDdevXhprofXhguiEnabled
TestDebugDeleteVolumeCmd TestDebugRebuildCmd TestEphemeralPortsReusedOnRestart TestGetApps
TestGetAppsEmpty TestHardenedStart TestHttpsRedirection TestMysqlCommand TestPHPConfig
TestPHPWebserverType TestProcessHooks TestProjectAutocompletionForExecCmd
TestRouterPortSubstitutionPersistsAcrossProjects TestSnapshotUncompressed
TestWebserverMariaMySQLDBClient TestWriteDrushConfig
```

Some of the 16 tests that never ran in full may fail after being skipped this long; this PR's run is where that should show up.

🤖 Developed with assistance from [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
stasadev added a commit to stasadev/ddev that referenced this pull request Oct 8, 2026
Since ddev#8234 moved app.Exec to the docker-compose library, Exec returns the command's output instead of writing it to UserOut, so the CaptureUserOut in isValidComposerOption always read an empty string. Every option then failed validation for `run-script`, which dropped `--no-dev` and `-vvv` from the post-root-package-install and post-create-project-cmd runs, and no unknown option was ever rejected for `create-project`. It now reads the stderr that Exec returns, where Composer prints the "option does not exist" error.

TestComposerCreateProjectCmd caught this in the all-project-types job, which hadn't run it since ddev#7027 renamed it in March 2025.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants