Conversation
| echo "Creating continer with: sudo -E -H -u {{{ runContext.user }}} docker create $DOCKER_OPTIONS $DOCKER_IMAGE {{{ runContext.cmd }}}" | ||
| cid=`sudo -E -H -u {{{ runContext.user }}} docker create $DOCKER_OPTIONS $DOCKER_IMAGE {{{runContext.cmd }}}` | ||
| echo "Creating continer with: sudo -E -H -u {{{ runContext.user }}} docker create $DOCKER_OPTIONS {{#each envContext.env}}{{#ifHasNewLines value}}-e {{{name}}}={{#escapedNewLines value}}{{/escapedNewLines}}{{/ifHasNewLines}}{{/each}} $DOCKER_IMAGE {{{ runContext.cmd }}}" | ||
| cid=`sudo -E -H -u {{{ runContext.user }}} docker create $DOCKER_OPTIONS {{#each envContext.env}}{{#ifHasNewLines value}}-e {{{name}}}={{#escapedNewLines value}}{{/escapedNewLines}}{{/ifHasNewLines}}{{/each}} $DOCKER_IMAGE {{{runContext.cmd }}}` |
There was a problem hiding this comment.
i'm not sure you need closing blocks for escapedNewLines
|
For posterity, can you explain what this PR exactly does? Seems like it adds explicit |
|
Explanation for this: When docker reads a .env file, it is not interpreted like bash as one would expect. Docker has its own parser that reads the variables in. This parser does not handle values that span multiple lines, even if they are quoted. So, any lines following a value with new lines could be messed up when read, and the value with new lines will only have the first line. When instead using explicit What this PR does is separates out any environment variables that may contain new lines and sets them using |
@jonathanwgoodwin was a bit trickier than I thought, but this should work