From 66315c47a593cffe65bbba007f5384ed97df62c1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 03:16:55 +0000 Subject: [PATCH 1/2] fix: download `head` builds with `ddev utility download-ddev`, for #58 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Short Summary (TL;DR) `version: head` now installs stable DDEV, then replaces it with the `main` build that `ddev utility download-ddev --head` downloads from GitHub. Before, every `head` install depended on nightly.link, which fails intermittently. ## The Issue - For #58 The `head` jobs in this repository's nightly tests fail every few weeks in the "Install DDEV" step. `install_ddev_head.sh` downloads `https://nightly.link/ddev/ddev/workflows/main-build/main/ddev-linux-amd64.zip`, and nightly.link returned an HTTP 404 or 500 while the artifact existed on GitHub: | Date | Run | Error | | --- | --- | --- | | 2026-11-22 | [44964784133](https://github.com/ddev/github-action-setup-ddev/actions/runs/44964784133) | 500 on two attempts, 2 hours apart | | 2026-10-02 | [36945282755](https://github.com/ddev/github-action-setup-ddev/actions/runs/36945282755) | 404 on amd64 only, arm64 passed | | 2026-09-28 | [36361796895](https://github.com/ddev/github-action-setup-ddev/actions/runs/36361796895) | 404 | | 2026-09-23 | [35801261825](https://github.com/ddev/github-action-setup-ddev/actions/runs/35801261825) | 404 | The same problem affects users who test against `head`. `install_ddev_head.sh` has no retry and no other source. ## How This PR Solves The Issue - For `head`, the action runs the normal install script, which installs the latest stable release. Since v1.25.4, stable includes `ddev utility download-ddev`. - A new step runs `ddev utility download-ddev --head`. It finds the latest successful `main-build` run through the GitHub API, and downloads the artifact from GitHub. It uses nightly.link only when that fails. - The step overwrites the stable `ddev` and `ddev-hostname` in place, so the two binaries always match. - A new `token` input defaults to `${{ github.token }}`, so users don't have to set anything. Without a token, `download-ddev` uses nightly.link to download. - `ddev config global` moves to its own step after the replacement, so it runs on the final binary. - `head` no longer swaps the install script for `install_ddev_head.sh`. A custom `installScriptUrl` now installs the stable base for `head`. - The steps pass inputs through `env` instead of putting `${{ inputs.* }}` into the shell script. ## Manual Testing Instructions Run the `tests` workflow on this branch: ```bash gh workflow run main.yml -R ddev/github-action-setup-ddev --ref 20261122_rfay_head_download_ddev ``` In the `test (ubuntu-24.04, head)` job, expand "Replace DDEV with the HEAD build". Expect `Downloading ddev linux/amd64 from the latest main build...`, with no nightly.link warning. Expect a version such as `ddev version v1.25.6-1-g24cd0c83b`. Check that the `latest` and `1.24.8` jobs don't run that step. ## Automated Testing Overview This repository's `tests` workflow covers `head`, `latest` and `1.24.8` on `ubuntu-24.04` and `ubuntu-24.04-arm`. Claude Code ran `ddev utility download-ddev --head` locally on Linux amd64, without a token. It downloaded `v1.25.6-1-g24cd0c83b`. Only CI can show that the workflow token downloads `ddev/ddev` artifacts from GitHub. ## Release/Deployment Notes A `head` install now downloads stable DDEV first. That adds a few seconds. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UrTUMwauQvTgWac6bsCPsm --- README.md | 10 +++++++++- action.yml | 51 ++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 260d86f..e28245c 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ default: `true` ### version -Install a specific ddev version. The version must be available in ddev's apt repository. +Install a specific ddev version, such as `1.24.8`, the latest stable release with `latest`, or the latest build of ddev's `main` branch with `head`. default: `latest` @@ -87,6 +87,14 @@ default: `latest` version: 1.24.8 ``` +`head` installs the latest stable release first, then replaces it with the `main` build using `ddev utility download-ddev --head`. + +### token + +GitHub token used to download the `head` build. With a token, the build comes from GitHub directly rather than through [nightly.link](https://nightly.link). The workflow's own token works, so you don't need to set this. + +default: `${{ github.token }}` + ### installScriptUrl URL to the DDEV installation script. This allows you to specify a custom or alternative source for the DDEV installation script. diff --git a/action.yml b/action.yml index fc1b60f..3a06329 100644 --- a/action.yml +++ b/action.yml @@ -23,38 +23,63 @@ inputs: required: true default: 'https://ddev.com/install.sh' + token: + description: 'GitHub token used to download the DDEV HEAD build (version: head) directly from GitHub instead of through nightly.link' + required: false + default: ${{ github.token }} + runs: using: 'composite' steps: - name: Download DDEV install script shell: bash + env: + INSTALL_SCRIPT_URL: ${{ inputs.installScriptUrl }} run: | - if [[ '${{ inputs.version }}' == 'head' && '${{ inputs.installScriptUrl }}' == 'https://ddev.com/install.sh' ]]; then - SCRIPT_URL="https://raw.githubusercontent.com/ddev/ddev/main/scripts/install_ddev_head.sh" - echo "Using head version install script: ${SCRIPT_URL}" - else - SCRIPT_URL="${{ inputs.installScriptUrl }}" - fi - curl -fsSL --retry 3 --retry-max-time 60 --retry-connrefused -o /tmp/install_ddev.sh "${SCRIPT_URL}" + curl -fsSL --retry 3 --retry-max-time 60 --retry-connrefused -o /tmp/install_ddev.sh "${INSTALL_SCRIPT_URL}" - name: Install DDEV shell: bash + env: + DDEV_VERSION: ${{ inputs.version }} run: | - if [[ '${{ inputs.version }}' == 'latest' ]]; then + if [[ "${DDEV_VERSION}" == 'latest' ]]; then VERSION_ARG="" echo "Installing latest stable DDEV version" - elif [[ '${{ inputs.version }}' == 'head' ]]; then + elif [[ "${DDEV_VERSION}" == 'head' ]]; then + # HEAD is installed by replacing the stable binaries in the next step VERSION_ARG="" - echo "Installing DDEV HEAD version" + echo "Installing latest stable DDEV version, to be replaced with the HEAD build" else - VERSION_ARG="v${{ inputs.version }}" + VERSION_ARG="v${DDEV_VERSION}" echo "Installing DDEV version: ${VERSION_ARG}" fi - + # Make installation script executable chmod +x /tmp/install_ddev.sh - + /tmp/install_ddev.sh ${VERSION_ARG} + + - name: Replace DDEV with the HEAD build + shell: bash + if: inputs.version == 'head' + env: + # With a token, download-ddev gets the build from GitHub directly, + # and uses nightly.link only if that fails + DDEV_GITHUB_TOKEN: ${{ inputs.token }} + run: | + head_dir="${RUNNER_TEMP}/ddev-head" + ddev utility download-ddev --head --output "${head_dir}" + # Overwrite the stable binaries in place, so ddev and ddev-hostname stay + # a matching pair wherever they are called from + ddev_dir="$(dirname "$(command -v ddev)")" + sudo install -m 0755 "${head_dir}/ddev" "${head_dir}/ddev-hostname" "${ddev_dir}/" + rm -rf "${head_dir}" + ddev --version + + - name: Configure DDEV + shell: bash + run: | ddev config global --instrumentation-opt-in=false --omit-containers=ddev-ssh-agent - name: Start DDEV project From fb10dfde797528616d6c5c4ae6a5d31be211c13a Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Wed, 25 Nov 2026 09:36:38 -0700 Subject: [PATCH 2/2] fix: address review on `head` download, drop the `token` input - Pass the workflow's own token to `ddev utility download-ddev` directly instead of through a new `token` input, so there is one less input to support. - Mention `latest` and `head` in the `version` input's description. - Check for the `-g` suffix in the `head` test, so it fails if the replace step is skipped. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/main.yml | 3 +++ README.md | 8 +------- action.yml | 9 ++------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e21108..1737ba5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,6 +45,9 @@ jobs: ddev --version if [[ ${{ matrix.version }} == '1.24.8' ]]; then test "$(ddev --version)" == 'ddev version v1.24.8' + elif [[ ${{ matrix.version }} == 'head' ]]; then + # A build of main has a -g suffix, which the stable release lacks + [[ "$(ddev --version)" =~ -g[0-9a-f]+$ ]] else test "$(ddev --version)" != 'ddev version v1.24.8' fi diff --git a/README.md b/README.md index e28245c..38c9821 100644 --- a/README.md +++ b/README.md @@ -87,13 +87,7 @@ default: `latest` version: 1.24.8 ``` -`head` installs the latest stable release first, then replaces it with the `main` build using `ddev utility download-ddev --head`. - -### token - -GitHub token used to download the `head` build. With a token, the build comes from GitHub directly rather than through [nightly.link](https://nightly.link). The workflow's own token works, so you don't need to set this. - -default: `${{ github.token }}` +`head` installs the latest stable release first, then replaces it with the `main` build using `ddev utility download-ddev --head`. The action passes the workflow's own token, so the build comes from GitHub directly rather than through [nightly.link](https://nightly.link). ### installScriptUrl diff --git a/action.yml b/action.yml index 3a06329..cd68a65 100644 --- a/action.yml +++ b/action.yml @@ -14,7 +14,7 @@ inputs: default: 'true' version: - description: 'Install a specific DDEV version. Example: 1.24.0' + description: 'DDEV version to install: latest (the default), head (the latest build of the main branch), or a release number such as 1.24.8' required: false default: 'latest' @@ -23,11 +23,6 @@ inputs: required: true default: 'https://ddev.com/install.sh' - token: - description: 'GitHub token used to download the DDEV HEAD build (version: head) directly from GitHub instead of through nightly.link' - required: false - default: ${{ github.token }} - runs: using: 'composite' steps: @@ -66,7 +61,7 @@ runs: env: # With a token, download-ddev gets the build from GitHub directly, # and uses nightly.link only if that fails - DDEV_GITHUB_TOKEN: ${{ inputs.token }} + DDEV_GITHUB_TOKEN: ${{ github.token }} run: | head_dir="${RUNNER_TEMP}/ddev-head" ddev utility download-ddev --head --output "${head_dir}"