Pipeline Configuration file
ReadyMage supports user defined configuration file that can inject various actions into different points of build/deploy pipeline or customize existing pipeline logic.
Used terms
Vanilla Magento theme - a theme which uses Magento built in mechanisms of theme server-side compilation. For example Magento/Luma.
How to use
Add the readymage.yaml file to Magento 2 root folder. It's the folder which contains base Magento 2composer.* files.
├── 📁 app
├── 📄 composer.json
├── 📄 composer.lock
└── 📄 readymage.yamlExamples
Schema
By default, ReadyMage will attempt to validate configuration file before running its directives. If its invalid, the build will automatically fail with a relevant error about which parts of the schema are invalid or failed to be ran.
schema_version
schema_versionRequired. Specifies which schema version is used in the configuration file. Allowed values: 1.0.0
environments
environmentsOptional. Array of environment specific configurations
nameRequired. Environment full name.
buildOptional. Nested dictionary containing build specific configurations.
themesOptional. Dictionary of environment themes. Themes directive allows to specify which of themes should be built. This includes theme compilation and locale specific static file generation.
{theme}Theme ID
<Vendor>/<theme>as defined in registration.php. Useallto generate static files for all Magento themes.areaOptional. Allowed values:
all,frontend,adminhtml. If not defined, will fallback toalllanguagesOptional. Allowed values: array of strings. If not defined, will fallback to locales specified in
config.phpor if none found - toen_USplaybookOptional. Specifies which of the playbooks should be called during theme compilation. Ignored if theme ID is set to
alldirectoryRequired if playbook field is set. Specifies in which directory the theme is located at. Ignored if theme ID is set to
all
hooksOptional. Hooks are a way to inject custom logic around automated actions (e.g. build). For example, if you need to swapconfig.phpfile for specific environment before the build. Allowed values:pre_build,post_build.To customize theme compilation and static content file generation logic, use playbook and theme directives instead of using the hooks.pre_buildThis hook is run before automated build phase. Can contain only actions. Any actions here will permanently disable build cache until all of the actions are removed. It will result in permanently increased build times.post_buildThis hook is run after automated build phase. Can contain only actions.
deployOptional. Nested dictionary containing deploy specific configurations.hooksOptional. Hooks in this context offer a way to execute the needed commands throughout the deployment.post_deployThis hook runs after the deployment has completed successfully. Available commands arephpandcurlonly.
playbooks
playbooksOptional. Dictionary of playbooks.
A playbook is set of actions that are called on the theme build/compilation step. It’s invoked during the build pipeline before automated setup:static-content:deploy. To customize static-content deployment, use themes directive.
Playbooks can only contain actions. All the actions defined inside a playbook will be executed in sequentially manner.
Out of the box ReadyMage provides several playbooks, alongside with the possibility of defining fully custom playbooks.
scandipwa, scandipwa_npm
scandipwa, scandipwa_npmCurated, builtin playbook which is actively maintained and test against 3.x and higher ScandiPWA themes. The approximation of the curated playbook can be expressed using following actions:
playbooks:
scandipwa_npm_aprox:
- npm:
command: ci
directory: scandipwa
- npm:
command: build
directory: scandipwa
env_vars:
BUILD_MODE: magentoscandipwa_yarn
scandipwa_yarnCurated, builtin playbook which is actively maintained and test against 3.x and higher ScandiPWA themes. The approximation of the curated playbook can be expressed using following actions:
playbooks:
scandipwa_yarn_aprox:
- yarn:
command: install --immutable --immutable-cache --check-cache
directory: scandipwa
- yarn:
command: build
directory: scandipwa
env_vars:
BUILD_MODE: magentoCustom
To create custom theme build/compilation logic which falls outside the curated playbooks, simply create a custom playbook where all of the necessary build actions can be defined. This can be accomplished by defining a set of actions grouped inside the playbook that will be responsible for theme compilation. The resulting playbook will be available on any environments themes playbook field.
actions
actionsActions are generic, cherry-picked commands that are executed in pre-defined places inside the deployment pipeline. Actions can only be used inside playbooks or hooks.
copyCopies from source to destination. The path is relative to the Magento installation directory. Will overwrite file/directory if it exists at destination.{source}: {destination}
moveMoves from source to destination. The path is relative to the Magento installation directory. Will overwrite the file/directory if it exists at destination.{source}: {destination}
symlinkCreates symbolic link at the path pointing to the target. The path is relative to the Magento installation directory. The target is relative to the Magento installation directory, unless prefiexed with
persistent:Will overwrite the file/directory if it exists at path.{path}: {target}Usepersistent:prefix in target to set a symlink persistent and shared directory.
composerRuns custom composer v1 or v2 commands. Use only if you have additional non-magento composer installations inside the project that have to be initialized after the main build.
command- Required.version- Required. Allowed values:1,2directory- Optional. If not defined, will fallback to theme directory.
Composer state should be always managed by composer.json and composer.lock files instead of configuration file actions!
curl (available on post_deploy hooks only)
curl (available on post_deploy hooks only) command- Required.directory- Required. Must specify an absolute path to the/mnt/directory.filename- Required. Must specify the name of the downloaded file.
Schema migrations
Migration guide from 0.x.x to 1.0.0Last updated
Was this helpful?