Repository navigation
build: pin PHP builds and checksums, and update them automatically - #245
Merged
Merged
Conversation
Download PHP from the cli-php-builds tag php-$(PHP_VERSION)-$(PHP_BUILD), as each rebuild (for a PHP or library release) now gets a new build number. Pin the SHA-256 checksums of the PHP binaries in internal/legacy/php_sha256sums.txt (a copy of the release's SHA256SUMS.txt), and pin the CA bundle by date and checksum, instead of downloading the latest unverified. Downloads are verified in the Makefile and in the Windows CI job. The release cache key now depends on the checksums. Add a daily update-php workflow, which runs scripts/update-php.sh to find the latest build for the current PHP minor version and the latest CA bundle, verifies the downloads, and opens or updates a pull request with a GitHub App token (so that CI runs on it). The pull request lists the changed source archives, from the releases' sources.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Warning
Changes suggested — 🟡 1 warning · 🔵 1 minor point
🔍 Full review · 7 files reviewed
Verification
- The
^PHP_BUILD =patterns in ci.yml and update-php.sh (read and sed -i write) cannot matchPHP_BUILDS_REPO = ..., because they need a space after PHP_BUILD. - In the Makefile, a missing or empty checksum fails at
test -n, and.DELETE_ON_ERRORremoves the bad download. - With pipefail on, the release lookup ends in
|| true, so finding no matching tag exits through the 'No release found' error, not a silent set -e abort. sort -Vorders tags like php-8.5.9-3 before php-8.5.11-0, and build -1 before -10, so the latest-tag pick is numeric.- The release cache key now hashes php_sha256sums.txt; a restored php-version file whose tag doesn't match still forces a re-download through the FORCE rule.
The PR adds no tests. The Makefile checksum path is exercised by the CI integration-test job (make php), and the Windows download and checksum steps by the windows-cert-store job. update-php.yml and scripts/update-php.sh only run on schedule or manual dispatch; no CI job tests the script's tag comparison or checksum handling.
Review details
- Commit: 9ff3595
- Model: claude-opus-5-5
Review 1 of 10 for this pull request · View the full run
Builds in cli-php-builds are numbered from 1, so PHP_BUILD = 0 never matches an existing release, and the script always updates the checksums. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uses the per-build release tags from upsun/cli-php-builds#3 (
php-X.Y.Z-N), pins checksums, and adds a daily workflow that opens a pull request when there is a new build.Makefile: addsPHP_BUILDnext toPHP_VERSION(which stays the plain PHP version for ldflags), and downloads fromphp-$(PHP_VERSION)-$(PHP_BUILD).internal/legacy/php_sha256sums.txtis a copy of the release'sSHA256SUMS.txt. Downloads are verified against it, and the file is deleted on mismatch.cacert-<CACERT_DATE>.pemand verifiesCACERT_SHA256, instead of fetching the latest one without verification.update-phpworkflow (daily andworkflow_dispatch): runsscripts/update-php.sh. The script finds the latest release for the current PHP minor version (sort -V) and the latest CA bundle, then updates the Makefile and checksums. The workflow then runsmake download-phpand checks the PHP version. If anything changed, it pushesautomated/update-phpand opens or updates a pull request. The PR body lists the changedsources.jsonarchives (old vs. new, by platform). It does not push again if the branch already has the same update.upsun-cli-php-updatesGitHub App (actions/create-github-app-token, pinned by SHA), so CI runs on the PR. The job uses thephp-updatesenvironment (APP_IDvariable,APP_PRIVATE_KEYsecret). Other steps useGITHUB_TOKENwithcontents: read.🤖 Generated with Claude Code