feat(utility): add ddev utility addon-update-checker command#8373
feat(utility): add ddev utility addon-update-checker command#8373
ddev utility addon-update-checker command#8373Conversation
ddev utility addon-update-checker command
|
Download the artifacts for this pull request:
See Testing a PR. |
|
Pretty cool! I doubt that it would belong in |
|
FWIW, the test checks whether the update checker is actually working (i.e. available). |
|
And having a dedicated command increases the chance that people actually use it. I’ve caught myself doing this several times: I work on an add-on, think it would be good to check for updates, then realize I need to google the command to run, and end up telling myself, "No, I’ll do it later." |
|
I've simplified the logic by moving the support for workspaces to the script itself. Static validation fail is handled in #8375 |
## The Issue Running the DDEV add-on update checker requires remembering the command `curl -fsSL https://ddev.com/s/addon-update-checker.sh | bash`, which is impossible to recall without looking it up every time. On top of that, when maintaining multiple add-ons, you have to `cd` into each directory and run the command individually — there's no way to check all add-ons at once and then feed the combined output to an AI to fix everything in one go. ## How This PR Solves The Issue Adds `ddev utility addon-update-checker` (alias: `ddev ut addon-update-checker`), which fetches and runs the update checker script automatically: - If the target directory contains `install.yaml`, the checker runs there. - Otherwise it scans immediate subdirectories for `install.yaml` and runs the checker in each one — useful for workspaces with multiple add-ons. - Each run is clearly labelled with the directory, live output, and exit code (green for success, red for failure). - Falls back to the raw GitHub script URL if the primary URL is unavailable. - Uses `util.FindBashPath()` for cross-platform bash discovery. - Supports `-d`/`--dir` flag to target a specific directory or workspace. ## Manual Testing Instructions Run in a single add-on directory: ```shell cd /path/to/my-addon # must contain install.yaml ddev utility addon-update-checker ``` Run across a workspace of add-ons: ```shell ddev utility addon-update-checker -d /path/to/my-addons-workspace ``` Verify that a directory without `install.yaml` fails with a clear error: ```shell ddev utility addon-update-checker -d /tmp ``` ## Automated Testing Overview `TestUtilityAddonUpdateCheckerCmd` in `utility-addon-update-checker_test.go` covers three cases: - `SingleAddon`: directory with `install.yaml` — verifies the dir is reported and an exit code is printed. - `MultipleAddons`: workspace with two subdirs each containing `install.yaml` — verifies both are checked and two exit codes appear. - `NoInstallYaml`: empty directory — verifies the command fails with "No install.yaml found". ## Release/Deployment Notes New `ddev utility addon-update-checker` subcommand. No breaking changes. Documentation added to `commands.md` and `creating-add-ons.md`. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
9e5011b to
c845a0f
Compare
tyler36
left a comment
There was a problem hiding this comment.
Works well. This is great!
Confirmed:
- ✅ inside addon directory
- ✅ inside parent directory containing multiple addon folders
The Issue
Running the DDEV add-on update checker requires remembering the command
curl -fsSL https://ddev.com/s/addon-update-checker.sh | bash, which is impossible to recall without looking it up every time. On top of that, when maintaining multiple add-ons, you have tocdinto each directory and run the command individually - there's no way to check all add-ons at once and then feed the combined output to an AI to fix everything in one go.How This PR Solves The Issue
Adds
ddev utility addon-update-checker, which fetches and runs the update checker script automatically:install.yaml, the checker runs there.install.yamland runs the checker in each one - useful for workspaces with multiple add-ons.NO_COLORsupport.util.FindBashPath()for cross-platform bash discovery.-d/--dirflag to target a specific directory or workspace.The workspace scanning logic lives in the bash script itself (see ddev-addon-template#104), so it also works when running the script directly via
curl. The Go command simply fetches the script and runs it once in the target directory.Manual Testing Instructions
https://ddev--8373.org.readthedocs.build/en/8373/users/extend/creating-add-ons/#keeping-your-add-on-up-to-date
https://ddev--8373.org.readthedocs.build/en/8373/users/usage/commands/#utility-addon-update-checker
Run in a single add-on directory:
Run across a workspace of add-ons:
Verify that a directory without
install.yamlfails with a clear error:Automated Testing Overview
TestUtilityAddonUpdateCheckerCmdinutility-addon-update-checker_test.gocovers three cases:SingleAddon: directory withinstall.yaml— verifies the dir is reported in output.MultipleAddons: workspace with two subdirs each containinginstall.yaml— verifies both are checked.NoInstallYaml: empty directory — verifies the command fails with "No install.yaml found".Release/Deployment Notes
New
ddev utility addon-update-checkersubcommand. No breaking changes. Documentation added tocommands.mdandcreating-add-ons.md.Update https://github.com/ddev/ddev-addon-template and https://ddev.com/blog/ddev-add-on-maintenance-guide/ after the next release.