Skip to content

Commit

Permalink
docs: more updates in the substitutions sections (#55)
Browse files Browse the repository at this point in the history
Signed-off-by: mbshields <[email protected]>
  • Loading branch information
mbshields authored Apr 16, 2024
1 parent 8bdbc03 commit e61c020
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
13 changes: 8 additions & 5 deletions docs/reference/stacker_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ During a stacker build, the behavior of stacker is specified by yaml directives

## Substitutions and variables

In the yaml directives, stacker allows variable substitions of several forms. For example, these three substition statements:
Before parsing the yaml directives, stacker performs substitions on any variable placeholders of the format `${{VAR}}` or `${{VAR:default}}` in the directives. For example, when a stacker build is run with this command:

$ONE ${{TWO}} ${{THREE:3}}
`stacker build --substitute ONE=1`

when run with `stacker build --substitute ONE=1 --substitute TWO=2` are
processed by stacker as:
these variable placeholders:

1 2 3
${{ONE}} ${{TWO:3}}

are replaced by stacker with these values:

1 3

In order to avoid conflict with bash or POSIX shells in the `run` section, only placeholders with two braces are supported, e.g. `${{FOO}}`. Placeholders with a default value like `${{FOO:default}}` will evaluate to their default if not specified on the command line or in a substitution file.

Expand Down
13 changes: 8 additions & 5 deletions docs/user_guide/template_substitution.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Template Variable Substitution

In the yaml directives that direct a stacker build, stacker allows variable substitions of several forms. For example, these three substition statements:
Before parsing the yaml directives that direct a stacker build, stacker performs substitions on any variable placeholders of the format `${{VAR}}` or `${{VAR:default}}` in the directives. For example, when a stacker build is run with this command:

$ONE ${{TWO}} ${{THREE:3}}
`stacker build --substitute ONE=1`

when run with `stacker build --substitute ONE=1 --substitute TWO=2` are
processed by stacker as:
these variable placeholders:

1 2 3
${{ONE}} ${{TWO:3}}

are replaced by stacker with these values:

1 3

In order to avoid conflict with bash or POSIX shells in the `run` section, only placeholders with two braces are supported, such as `${{FOO}}`. Placeholders with a default value like `${{FOO:default}}` will evaluate to their default if not specified on the command line or in a substitution file.

Expand Down

0 comments on commit e61c020

Please sign in to comment.