Skip to content

IBX-11919: Build CI assets with yarn encore prod - #112

Closed
micszo wants to merge 2 commits into
mainfrom
IBX-11919-encore-prod-on-ci
Closed

IBX-11919: Build CI assets with yarn encore prod#112
micszo wants to merge 2 commits into
mainfrom
IBX-11919-encore-prod-on-ci

Conversation

@micszo

@micszo micszo commented Aug 25, 2026

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-11919

Related PRs:

ibexa/ci-scripts#143 — companion PR, handles the equivalent composer run post-install-cmd call in prepare_project_edition.sh that runs before this reusable workflow even starts, updated with the same two-step approach.
Regression run: ibexa/oss#290

Description:

Browser-tests CI runs the app under APP_ENV=behat for the entire pipeline (required for FriendsOfBehat / Behat test execution). ibexa:encore:compile (see Ibexa\Bundle\AdminUi\Command\CompileAssetsCommand) only runs yarn encore prod when the console's ambient --env option equals prod; that option defaults to APP_ENV. Since this workflow never sets APP_ENV=prod, every composer run post-install-cmd call here silently compiled assets with yarn encore dev, on every edition and version.

Initial approach (superseded): overriding APP_ENV=prod on each of those composer run post-install-cmd exec calls. A regression run (ibexa/oss#290) caught that this breaks Behat: composer run post-install-cmd also runs cache:clear first (via @auto-scripts), and forcing that to boot the Symfony kernel under prod excludes IbexaBehatBundle (registered only for the behat env in config/bundles.php) from kernel.bundles_metadata. That silently drops ibexa/behat's encore config (transition-listener.js) from the generated var/encore/*.js manifest, so the compiled admin-ui bundle never adds the ibexa-selenium-transition-* marker classes that Behat's transition-wait conditions poll for — every scenario using ElementTransitionHasEndedCondition (e.g. IbexaDropdown::verifyIsLoaded()) then fails with TimeoutException: Transition has not started at all.

Current approach: leave composer run post-install-cmd unmodified at all 11 call sites (compatibility-layer setup, all three multirepository setup variants, and both test-setup phases), so cache:clear keeps booting under the existing behat env and the generated var/encore/*.js manifest stays correct. Immediately after each one, run the production asset build as a separate, plain yarn encore prod --config-name app && yarn encore prod call — this never boots the Symfony kernel, so it can't re-trigger the bundle-discovery bug, while still producing a genuine yarn encore prod build (mirrors the exact two-step ibexa:encore:compile --config-name app + ibexa:encore:compile sequence composer's @auto-scripts already runs).

For QA:

  • Trigger a browser-tests regression run ([TMP] Run regression oss#290) against this branch and confirm assets are built with yarn encore prod (not dev).
  • First regression run (all 3 oss setups against the initial -e APP_ENV=prod approach) failed with isIbexaDropdownVisible/ibexa-dropdown-popover transition timeouts across every job — root-caused to the IbexaBehatBundle/var/encore issue above.
  • Re-run the regression (currently scoped to regression-oss-setup3 — PHP 8.4/Node 22/MySQL 8.4/Solr 8/Redis latest — in oss#290) against the updated two-step approach and confirm Behat tests pass with prod-built assets.
  • Confirm APP_ENV=behat is unaffected at runtime (unchanged from the original approach).

Browser-tests CI runs the app under APP_ENV=behat throughout the
pipeline. ibexa:encore:compile decides between yarn encore dev/prod
based on the ambient console --env option, which defaults to
APP_ENV, so every composer run post-install-cmd call in this
workflow was silently compiling assets in dev mode.

Override APP_ENV=prod for just those composer run post-install-cmd
exec calls (initial compatibility-layer setup, multirepository
setup, and both test-setup phases), so asset compilation uses a
production build while the app container keeps running under
APP_ENV=behat for the actual Behat test execution.
Same fix as the companion ci-scripts change: overriding APP_ENV=prod
for the whole `composer run post-install-cmd` call also switches the
Symfony kernel env used by cache:clear, which excludes
IbexaBehatBundle (registered only for 'behat') from
kernel.bundles_metadata. That silently drops ibexa/behat's encore
config (transition-listener.js) from var/encore/*.js, so the compiled
admin-ui bundle never adds the ibexa-selenium-transition-*
marker classes Behat's transition-wait conditions poll for.

Run post-install-cmd unmodified in all 11 call sites (still under the
behat env, so the generated var/encore manifest stays correct), then
rebuild assets in production mode via a separate, plain
`yarn encore prod` call that never touches the Symfony kernel/env.
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

@micszo

micszo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing, ibexa/ci-scripts#143 is sufficient.

@micszo micszo closed this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant