Skip to content
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

RUN <<EOF without an interpreter and cachi2 #1200

Open
owtaylor opened this issue Jul 25, 2024 · 3 comments
Open

RUN <<EOF without an interpreter and cachi2 #1200

owtaylor opened this issue Jul 25, 2024 · 3 comments

Comments

@owtaylor
Copy link
Contributor

RUN <<EOF
mkdir -p /etc/foo
cp -aR /src/foo /etc/foo
EOF

gets turned into:

RUN . /cachi2/cachi2.env && <<EOF
mkdir -p /etc/foo
cp -aR /src/foo /etc/foo
EOF

which is weirdly not a syntax error, but a no-op. The right transformation would be something like:

RUN . /cachi2/cachi2.env && /bin/sh <<EOF
mkdir -p /etc/foo
cp -aR /src/foo /etc/foo
EOF

Once you consider RUN --mount=type=bin,src=/a,dest=/b <<EOF wedging this into the current code gets a little tricky.

@chmeliik
Copy link
Contributor

@owtaylor I would assume this is not critical since there is a fairly easy workaround (use /bin/sh <<EOF rather than just <<EOF)?

But we should fix this at some point. A good Dockerfile parser+editor will be needed.

@eskultety
Copy link
Contributor

@owtaylor what is the benefit of using heredoc vs RUN cmd1 && cmd2 && cmdN? I agree that we need to support legitimate RUN options, but when it comes to heredoc I'm confused, does it serve a particular purpose in a Dockerfile or is it just a syntactic sugar?

@chmeliik
Copy link
Contributor

Just came across https://www.mankier.com/1/cstrans-df-run (in kdudka/konflux-test-multicluster-global-hub@8899893)

It doesn't handle heredocs correctly either, but perhaps a contribution would be reasonable (it's a C++ codebase, haven't looked into it much)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants