Commit Graph

5 Commits (master)

Author SHA1 Message Date
Justin Chadwell e3fd4a6450 Stabilize dockerfile heredoc support
Signed-off-by: Justin Chadwell <me@jedevc.com>
2022-02-10 11:29:21 +00:00
Justin Chadwell 8005660443 Fix heredoc COPY/ADD expansion to preserve quotes
In the contents of COPY/ADD, we perform expansion on variables using a
lexer. However, this lexer, by default, removes quotes as well as
expanding variables - this isn't really the kind of behavior we're
after, as it feels quite unintuitive.

To fix this, we introduce a new ExpandRaw function, which commands can
implement that implement an alternative expansion that preserves quotes
(and possibly other characters/features in the future).

Additionally, we introduce new tests to more clearly define the desired
behavior. One major note is that backslashes are not passed directly,
and are processed, following normal escape rules (so that we can use `$`
symbols directly).

Signed-off-by: Justin Chadwell <me@jedevc.com>
2022-01-31 10:53:58 +00:00
CrazyMax 54b8ff2fc8
go fmt: add //go:build
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-28 13:26:43 +02:00
Justin Chadwell ec1bfc88f6 Improve heredoc parsing to allow more generic words
Previously, heredoc names were restricted to simple alphanumeric
strings. However, heredocs should support much more complex use-cases,
including quoting anywhere, as well as allowing special symbols like `.`
for easily expressing file extensions.

This patch adds support for these more complex cases, by using the shell
lexer to parse each heredoc name. Additionally, we include improvements
to the lexer to optionally preserve escape tokens to avoid problems when
lexing words that have already been lexed before.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2021-07-01 09:13:58 +01:00
Justin Chadwell c362e15715 Add support for parsing heredocs in ADD/COPY and RUN
Signed-off-by: Justin Chadwell <me@jedevc.com>
2021-06-09 10:53:20 +01:00