Skip to content

Latest commit

 

History

History
85 lines (65 loc) · 3.71 KB

environments.md

File metadata and controls

85 lines (65 loc) · 3.71 KB

Environments

Config reference

merge

Define whether to merge the given environment map with the default map provided by MapFactory::createDefault().

  • Required: no
  • Default: false

map

Set a custom mapping to resolve local branches to asset environments. This is useful if you need to extend the default map by custom needs or exchange various branch configurations within the default map.

The configuration is transformed to a Map object, generated by MapFactory::crateFromArray(). Each mapping must include a branch pattern and a corresponding configuration for an environment transformer.

Tip

The branch pattern can be either a regular expression with delimiter / or any other string that is processable by the fnmatch function.

  • Required: no
  • Default:
{
    "environments": {
        "map": {
            "<branch pattern>": {
                "transformer": "<transformer type>",
                "options": "<transformer options>"
            }
        }
    }
}

Branch determination logic

The branch used for mapping the frontend environment is determined by the following logic:

Priority Logic Description
1. Environment variable Determination via environment variable $FRONTEND_ASSETS_BRANCH
2. CI Determination via ondram/ci-detector package
3. Git Determination via command git symbolic-ref --short HEAD

Environment resolving

Frontend assets are stored in asset environments and must also be requested through them. In order to identify which asset environment should be requested, a mapping takes place between the local development branch and the asset environment. This is done with the help of the EnvironmentResolver which is fed by a Map.

The default map generated by MapFactory::createDefault() resolves to the following mapping table:

Branch Environment Fallback
main {version} stable
master {version} stable
develop latest
release/* latest
feature/* fe-{slug}
preview preview
integration integration
renovate/* latest
/^v?\d+\.\d+\.\d+$/1) {branch}1)

1) If a specific version number is given, then exactly this version number is also requested as the asset environment. In this case, no mapping takes place.

Tip

You can extend or completely exchange the default map by your needs.