Allow stripping setup/ from production deploy artifacts (#40695)#40793
Allow stripping setup/ from production deploy artifacts (#40695)#40793lbajsarowicz wants to merge 1 commit into
Conversation
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Why deploy-ignore instead of removing
|
|
And what's the point for removing Also - and this is very specific - at our agency, we already completely delete Also why not deploy Also, why is |
I believe that beginner agencies expose their Clients at additional, unnecessary risks... Since Magento removed Web Install, the
That's just accidental change pushed along other. |
Issue magento#40695 - Add `magento-deploy-ignore` extra so deployment artifacts can strip /setup and /update directories (web Setup Wizard is deprecated; shipping it to production web nodes is unnecessary attack surface). - Add fallback autoload path to vendor/magento/magento2-base/setup/ for the Magento\Setup\* namespace so CLI tooling that still needs setup classes keeps resolving when the repository copy is stripped by the deploy-ignore step. Local development resolution is unchanged: setup/src/Magento/Setup/ remains the primary path. Verified `composer dump-autoload -o` generates 26959 classes and Magento\Setup\Console\Command\* loads.
36a914a to
139c8eb
Compare
|
Those 3 examples you give may be beginners indeed, but mostly is a misconfigured webserver which is not using
also, If those are beginners, why would they ever opt-in into this then? I mean, it won't solve anything for beginners if this is optional. But nevertheless, I agree that the setup directory should get refactored and eventually removed entirely from the codebase, but how it's done in this PR makes no sense in my opinion. We should do this without such strange workarounds, but instead doing it properly in the first place. And if a quick fix is really needed first, just delete the file |
|
@hostep Maybe we should also remove |
Description
Closes #40695 (partially — composer-side enabler).
The
setup/directory is a 568-file Laminas MVC application originally built for the deprecated web Setup Wizard. It is currently a hard runtime dependency forbin/magento. This PR is the smallest possible composer-layer change that lets a deployment pipeline stripsetup/from a runtime artifact without breaking theMagento\Setup\*namespace lookup that other CLI tooling still needs.Changes
extra.magento-deploy-ignore— declares/setup,/update,/pub/errors,/.gitignoreas paths that may be removed from a production deploy artifact. Honored bymagento/magento-composer-installerat deploy time.autoload.psr-4fallback forMagento\\Setup\\— array form: primary path stayssetup/src/Magento/Setup/(unchanged for local dev / source repo), secondary pathvendor/magento/magento2-base/setup/src/Magento/Setup/is resolved when the deploy-ignore step has removed the repository-root copy. Composer merges array entries; existing dev installs are unaffected.Why this approach
Full discussion in #40695. This PR intentionally does not:
@apiBC),Magento\Framework\Console\Cli,app/etc/di.xmlpreferences,Those are tracked in the issue as larger follow-ups requiring code review and benchmarks. This PR ships only the composer-manifest scaffolding so downstream pipelines can opt into stripping
setup/today.Verification
JSON syntax validated.
Backward Compatibility
magento-deploy-ignoreis opt-in; no existing deployment is affected unless tooling actively reads it.Manual testing instructions
composer installcomposer dump-autoload -obin/magento list— must work.setup/andupdate/permagento-deploy-ignore; runtime CLI commands that depend onMagento\Setup\*continue resolving via vendor copy ofmagento/magento2-base.Follow-up scope (out of this PR)
Cli.php:97require BP . '/setup/config/application.config.php'withfile_exists(issue Remove setup/ directory dependency from production artifacts #40695).SchemaSetupInterface/ModuleDataSetupInterfaceso the repository-rootsetup/is not required even whenvendor/magento/magento2-base/setup/is also absent.AbstractSetupCommandfrom the deprecatedMagento\Setup\Mvc\Bootstrap\InitParamListener.Related