Builtin args
Builtin args are variables with values automatically filled-in by Earthly.
The value of a builtin arg can never be overridden. However, you can always have an additional ARG
, which takes as the default value, the value of the builtin arg. The additional arg can be overridden. Example
Important
Earthly builtin args need to be pre-declared before they can be used. For example
General args
Name | Description | Example value |
---|---|---|
| Whether the build is being executed in --ci mode. |
|
| The git hash of the commit which built the currently running version of Earthly. |
|
| Whether the target is being executed |
|
| Whether |
|
| The version of Earthly currently running. |
|
Target-related args
Name | Description | Example value |
---|---|---|
| The name part of the canonical reference of the current target. | For the target |
| The project part of the canonical reference of the current target, but without the tag. | For the target |
| The project part of the canonical reference of the current target. | For the target |
| The tag part of the canonical reference of the current target, sanitized for safe use as a docker tag. This is guaranteed to be a valid docker tag, even if no canonical form exists, in which case, | For the target |
| For the target | |
| The canonical reference of the current target. |
Git-related args
Name | Description | Example value | Feature Flag |
---|---|---|---|
| The git author detected within the build context directory. If no git directory is detected, then the value is an empty string. This is currently the author's email address but the feature flag adds the name as well |
|
|
| The git author email detected within the build context directory. If no git directory is detected, then the value is an empty string. |
|
|
| The git author name detected within the build context directory. If no git directory is detected, then the value is an empty string. |
|
|
| The git co-authors detected within the build context directory, separated by space. If no git directory is detected, then the value is an empty string. |
| |
| The author timestamp, as unix seconds, of the git commit detected within the build context directory. If no git directory is detected, then the value is an empty string. |
| |
| The git branch of the git commit detected within the build context directory. If no git directory is detected, then the value is an empty string. |
| |
| The committer timestamp, as unix seconds, of the git commit detected within the build context directory. If no git directory is detected, then the value is an empty string. |
| |
| The git hash detected within the build context directory. If no git directory is detected, then the value is an empty string. Take care when using this arg, as the frequently changing git hash may be cause for not using the cache. |
| |
| The git URL detected within the build context directory. If no git directory is detected, then the value is an empty string. Please note that this may be inconsistent, depending on whether an HTTPS or SSH URL was used. |
| |
| The git project name from within the git URL detected within the build context directory. If no git directory is detected, then the value is an empty string. |
| |
| The git references of the git commit detected within the build context directory, separated by space. If no git directory is detected, then the value is an empty string. |
| |
| The first 8 characters of the git hash detected within the build context directory. If no git directory is detected, then the value is an empty string. Take care when using this arg, as the frequently changing git hash may be cause for not using the cache. |
| |
| The timestamp, as unix seconds, of the git commit detected within the build context directory. If no git directory is detected, then the value is |
|
Platform-related args
Name | Description | Example value |
---|---|---|
| The native processor architecture of the build runner. |
|
| The native OS of the build runner. |
|
| The native platform of the build runner. |
|
| The native processor architecture variant of the build runner. |
|
| The target processor architecture the target is being built for. |
|
| The target OS the target is being built for. |
|
| The target platform the target is being built for. This defaults to the native platform. |
|
| The target processor architecture variant the target is being built for. |
|
| The processor architecture of the user (the environment the |
|
| The OS of the user (the environment the |
|
| The platform of the user (the environment the |
|
| The processor architecture variant of the user (the environment the |
|
The default value of the TARGETPLATFORM
arg is the native platform of the runner, for non-LOCALLY targets. This can be overriden by using the --platform
flag, when using the earthly
CLI. For example, earthly --platform linux/amd64 +my-target
will set the TARGETPLATFORM
arg to linux/amd64
. You can also override the target platform in an Earthfile, when issuing BUILD
commands. For example, BUILD --platform linux/amd64 +my-target
. Or you can override the platform within the target definition by setting the platform in the FROM
statement. For example FROM --platform linux/amd64 alpine:3.13
.
Under LOCALLY
, the TARGETPLATFORM
arg is always set to the user platform (the environment the earthly
binary is invoked from) and it is not overriden by the --platform
flag.
Note
Under LOCALLY
targets, it is important to declare the TARGETPLATFORM
arg after the LOCALLY
command, to ensure that it gets the approriate user platform value. For example:
Last updated