CI configuration to accommodate several FE islands
What does this MR do and why?
The MR introduces the shared CI configuration to accommodate several FE islands without the need to manually update the config with every new FE island.
TL;DR; of the changes
-
scripts/validate_fe_islands_ci.rbscript to validate the FE islands CI configuration -
scripts/update_fe_islands_ci.rbscript to automatically update the FE islands CI configuration - a new
validate-fe-islands-ci"predictive" job that runs validation in CI - a new
validate-fe-islands-cicommand to run validation inpre-commithook of lefthook - extensive documentation on the FE islands structure (inline in the scripts and in
ee/frontend_islands/README.md), CI config, important jobs (in CI), and scripts (inpackage.json)
Detailed explanation
Most of the configuration is universal and doesn't need to be run on each particular island except for two jobs currently:
-
test-fe-islands- unit tests -
eslint:fe-islands- eslint analysis
To compliment the shared config and support these two cases still without the need for manual updates, the MR introduces two new scripts.
scripts/validate_fe_islands_ci.rb.
This script validates the existing CI configuration against the actual islands in ee/frontend_islands/apps. The validation passes only if:
- all the folder in apps/ have valid
package.json - all the
package.jsonfiles in the islands definetestandlintjobs
scripts/update_fe_islands_ci.rb
This script automatically updates the CI configuration (still keeping it explicit, no magic or abstractions) if there are apps with valid configuration (runs the previous validation step under the hood) so that the two jobs mentioned above would run parallel streams for each FE island.
Why validate if update runs validation as well?
Great question. The answer is in two other things this MR introduces:
- a new
validate-fe-islands-ciCI job that does run validation only as a quickly-failing job to fail early if the CI config for the FE islands isn't correct based on thevalidate_fe_islands_ci.rb's output. - we run validation for the FE islands in
pre-commithook in lefthook to fail as early as possible to avoid unnecessary CI runs
Typical workflow
Here's the typical lifecycle stages of a new FE island and the corresponding validation output at those points:
References
- Update CI configuration to accommodate several ... (#578506)
- Document how the components from the "islands" ... (#569715)
- Provide a comprehensive README with instruction... (#569355)
How to set up and validate locally
- Try following the workflow as depicted in the screenshots above to confirm the behavior
- If you have lefthook enabled locally, try comitting an "invalid" app (either empty package.json, or no script(s), etc.). Ensure lefthook runs the validation command and doesn't allow to commit
- Testing in CI is a bit more challenging, but you can observe the new job running on this MR (shouldn't fail)
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #578506







