-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: limit substitutions to double-braces (#598)
supporting substitution of $FOO or ${FOO} invites confusion and makes it hard to understand the behavior of a stackerfile by looking at it, because it can accidentally hard-code a value that is expected to be a shell variable in a run section. using double brackets is visually different and has the benefit of being invalid shell syntax, so you know that it is intended to be a stacker placeholder. Now if you specify --substitute FOO=bar and have $FOO or ${FOO} in your stackerfile, stacker will fail the operation and print errors. It first collects all instances of the error then prints them at the end, so you shouldn't have to run it over and over to get them all. Note that the previously documented behavior of allowing ${FOO:default} was not tested and did not work. That documentation is changed to reflect real life. Test changes: To avoid confusion about what substitution syntax we are testing, where possible, use quoted heredocs for stackerfiles in tests. This replaces use of e.g. $BUSYBOX_OCI, which was getting substituted by the shell before cat wrote it to a file, with ${{BUSYBOX_OCI}} in a quoted heredoc, so bash doesn't try to substitute it (which would fail), and instead stacker will see it and substitute it itself. This means adding a lot of --substitute args around where they were not previously required. A couple of places still use the previous approach so we can use the shell to sub in a file sha, for example. Signed-off-by: Michael McCracken <mikmccra@cisco.com>
- Loading branch information
1 parent
ee32587
commit 0bde03a
Showing
35 changed files
with
491 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.