Fix MOTD failure in CI by forcing APP_ENV=prod during composer install#345
Merged
Conversation
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.
This fixes a CI failure during
composer installwheremautic:motdwas exiting withMOTD response was empty.The issue was not the MOTD endpoint itself, but the environment the command was running in. Our CI
.envsetsAPP_ENV=test, so when Composer runs its post-install scripts,bin/console mautic:motdis executed with Mautic’s test configuration. Inapp/config/config_test.php, thehttp_clientservice is replaced withSymfony\Component\HttpClient\MockHttpClient, so no real HTTP request is made and the command receives an empty response body.The fix is to run
composer installwithAPP_ENV=prod, so Composer lifecycle scripts execute with the normal service configuration and use the real HTTP client. The rest of the workflow (installation, cache warmup, PHPUnit) still runs explicitly with--env=test, so test behavior remains unchanged.