-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build-args newline split #736
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing! That's SGTM but it appears your commit message is missing a DCO sign-off, causing the DCO check to fail: https://github.com/docker/build-push-action/pull/736/checks?check_run_id=9861389571
We require all commit messages to have a Signed-off-by line with your name and e-mail, which looks something like:
Signed-off-by: YourFirsName YourLastName <yourname@example.org>
Sorry for the hassle and let me know if you need help or more detailed instructions!
Signed-off-by: ruslandoga <67764432+ruslandoga@users.noreply.github.com>
DCO complained about
Using my username and github noreply email made it pass. I hope it's OK. |
You forgot to build javascript artifacts with
|
Signed-off-by: ruslandoga <67764432+ruslandoga@users.noreply.github.com>
Done: 3bfdd83 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks
@ruslandoga Hum I just recall it will break users that have multi line build arg value: #374 |
@ruslandoga Does it work if you add quotes with current version?: - uses: docker/build-push-action@v3
with:
build-args: |
"BUILD_INFO=${{ steps.meta.outputs.json }}" |
@crazy-max I think I've tried it and it didn't work because the quotes have to be escaped in JSON. I'll try again. |
It doesn't work: https://github.com/ruslandoga/docker-build-info/actions/runs/3909945739/jobs/6681579929
|
And using - uses: docker/build-push-action@v3
with:
build-args: |
BUILDINFO=${{ toJSON(steps.meta.outputs.json) }} Alternatively I think we could just create env vars in metadata-action for each output named:
So you could just set: - uses: docker/build-push-action@v3
with:
build-args: |
DOCKER_METADATA_JSON WDYT? |
/ # printenv BUILD_INFO
"{\"tags\":[\"ghcr.io/ruslandoga/docker-build-info:pr-3\",\"ghcr.io/ruslandoga/docker-build-info:toJson\",\"ghcr.io/ruslandoga/docker-build-info:ca87063\",\"ghcr.io/ruslandoga/docker-build-info:toJson-ca87063\"],\"labels\":{\"org.opencontainers.image.title\":\"docker-build-info\",\"org.opencontainers.image.description\":\"\",\"org.opencontainers.image.url\":\"https://github.com/ruslandoga/docker-build-info\",\"org.opencontainers.image.source\":\"https://github.com/ruslandoga/docker-build-info\",\"org.opencontainers.image.version\":\"pr-3\",\"org.opencontainers.image.created\":\"2023-01-13T09:45:48.327Z\",\"org.opencontainers.image.revision\":\"ca8706329ed9b7bfad723d9cc0cb96d08c9fba79\",\"org.opencontainers.image.licenses\":\"\"}}" I think the proper fix is to replace the CSV parser (it's splitting by commas that breaks arrays in JSON) with something more specific to the use-case:
quoted is a "nesting" counter that's incremented each time an unmatched Or maybe switching from build-args being a list to a dict could also be done. Then the values could use something like https://yaml-multiline.info if needed. In my use-case it probably wouldn't be required.
I think switching to |
@ruslandoga I made some changes to the metadata action to stringify the JSON output and looks to work on my side: https://github.com/docker/metadata-action/pull/257/files#diff-4fab5baaca5c14d2de62d8d2fceef376ddddcc8e9509d86cfa5643f51b89ce3dR73 - uses: docker/build-push-action@v3
with:
build-args:
BUILD_METADATA=${{ steps.meta.outputs.json }} FROM alpine
RUN apk add --no-cache jq
ARG BUILD_METADATA
RUN echo $BUILD_METADATA | jq Can you try with |
@crazy-max |
@ruslandoga Don't think it matters with |
|
Still, |
Added a new step to check this and looks fine to me: https://github.com/docker/metadata-action/actions/runs/3910598664/jobs/6682982486#step:5:188 |
Try adding more tags (I don't have problems with two tags in |
Ah yes indeed 😞 If you're willing to open a new PR with your suggestion to the CSV parser, feel free to do so. I will look later today at this issue if you have nothing yet. |
Fixes #726
redhat-actions/buildah-build
seem to be splitting by newlines