Closed mallycrip closed 1 year ago
As additional information, it seems there is an issue with actions-toolkit.
Thanks for taking time to debug.
As additional information, it seems there is an issue with actions-toolkit.
We have test cases that look to cover multi-line value already: https://github.com/docker/build-push-action/blob/f2a1d5e99d037542a71f64918e516c093c6f3fc4/__tests__/context.test.ts#L85-L107
I don't see any issue with the result from your screenshots. Let me know what you expect from your tests.
After the double quotes, the
--build-arg
command was abnormally called again, andRUN printenv TEMP
did not run because there was no value in TEMP.
If you have double quotes in a build-arg value, you need to escape them because this character is used to surround a field: https://csv.js.org/parse/options/quote/
What you can do for this case is just using an env var so you don't need to pass the build-arg value in the input:
...
- name: Get args
id: get_args
run: |
STR=$(cat << EOF
First line
Second "line"
"Third" "line"
EOF
)
echo 'STR_TEMP<<EOF' >> $GITHUB_ENV
echo $STR >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
build-args: |
STR_TEMP
...
FROM alpine
ARG STR_TEMP
RUN printenv STR_TEMP
...
I'm closing this issue in the meantime but leave a comment if you think there is still an issue or if we can improve our documentation.
Troubleshooting
Before submitting a bug report please read the Troubleshooting doc.
Behaviour
Steps to reproduce this issue
Below is the Docker file
And here is the action file.
Expected behaviour
When building an image, all values including double quotes are passed as build-args arguments, and the value is printed correctly in the
RUN printenv TEMP
command.Actual behaviour
After the double quotes, the
--build-arg
command was abnormally called again, andRUN printenv TEMP
did not run because there was no value in TEMP.