ci: deploy on merge and track latest stable API Platform - #690
Open
vincentchalamon wants to merge 1 commit into
Open
vincentchalamon wants to merge 1 commit into
vincentchalamon wants to merge 1 commit into
Conversation
Production was only reachable by pushing a tag, so every deployment required creating a GitHub release. Deploy from main instead, and drop releases. - cd.yml: trigger on push to main instead of tags, serialize helm deployments, drop the redundant :<ref_name> image tag, and pin production to main so a workflow_dispatch cannot deploy a feature branch unreviewed - deploy.yml: derive release and url from the caller inputs rather than from the event, add --atomic, and export namespace so the debug step can use it - upgrade-api-platform.yml: target the latest stable release including majors, ignore maintenance tags on older branches, never force-push over an upgrade already in flight, and report failures as an issue - ci.yml: drop the versioned branch filter, which was a regex and never matched - enable phpstan deprecation rules and the Rector Symfony set, so deprecations surface in the upgrade pull request and are fixed there
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.
Production was only reachable by pushing a tag, so
cd.ymllistening onpush: tagsmade every GitHub release a deployment trigger rather than a versioning act. A security fix could not ship without inventing an off-semver number, and^4.3.19capped the upgrade workflow to the current major.This deploys from
mainand drops releases entirely.Deployment
cd.ymltriggers onpushtomaininstead of tags.concurrencyserializes helm deployments. Two close merges would otherwise run two concurrenthelm upgrade prodand leave the release inpending-upgrade.cancel-in-progress: falseis deliberate: interrupting ahelm upgrade --waitblocks the next deployment.:<ref_name>image tag is dropped. Onmainit would duplicate:latestfor the same digest.:<sha>(the tag actually deployed) and:latest(scanned bysecurity.yml) are kept.deploy.ymlderivesreleaseandurlfrominputsinstead of re-deriving them fromgithub.event_name, which coupled a reusable workflow to its caller trigger.--atomicrolls back a failed deployment instead of leaving production half migrated.workflow_dispatchallows redeploying the tip ofmainafter a half-failed upgrade. It is pinned torefs/heads/mainat the job level: a dispatch can target any ref, so without that guard it would deploy a feature branch to production unreviewed.Upgrade workflow
git diff composer.lock | grep -oPparsing was capped by the Composer constraint, which is why chore: upgrade API Platform to 4.4.0 #689 proposes 4.4.0 while 5.0.0 is out.concurrencyat workflow level. Core dispatches one run per tag and regularly tags several majors the same day.release/api-platform-*pull request is open, socreate-pull-requestnever force-pushes over manual fixes made on an upgrade branch.Deprecations
failOnDeprecationis already enabled inphpunit.xml.dist, so a deprecation fromapi/src/fails the suite, but only where tests cover the code.phpstan/phpstan-deprecation-rulescatches calls to@deprecatedAPIs statically, andwithComposerBased(symfony: true)lets Rector auto-fix Symfony ones. Both run in CI already.Measured before adding them: PHPStan reports no pre-existing deprecation debt on 4.3.19. Rector proposed 5 files, applied here, mostly
#[Autowire(%env(X)%)]to#[Autowire(env: X)], plus removingUser::eraseCredentials(), which Symfony 8.1 no longer declares onUserInterfaceand which nothing calls.Also
ci.ymlhadbranches: [main, \d+.\d+]. GitHub branch filters accept globs, not regexes, so that second pattern never matched anything. Consequence: nothing ever wrote therefs/heads/mainbuildx cache scope, and every Docker build in this repository has been running cold. Fixing the filter lets CI populate the shared scope.Verification
phpstan analyseandrector process --dry-run: clean.helm lint: passes.api/composer.lock:current=4.3.19,latest=5.0.0, and the in-flight guard correctly declines because chore: upgrade API Platform to 4.4.0 #689 is open. Comparison verified on4.3.19,4.4.0,4.4.1,4.10.0,5.0.0,5.0.1.Follow-up, not in this pull request
mainruleset (20735297, currentlydeletion+non_fast_forwardonly). Once this merges, a direct push tomainis a direct push to production. Requires deciding onrequired_approving_review_count.4.3.mainwas created rather than renamed, so4.3still exists at the same SHA with no rules at all, and the upgrade workflow will stay blocked until chore: upgrade API Platform to 4.4.0 #689 is closed.3.2to4.2. Verified: none has a commit missing frommain, and each tip is covered by a tag. Check external links first, a deleted branch gets no redirect.