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

combination of warnings, errors and hints can get confusing #5263

Open
thaJeztah opened this issue Aug 19, 2024 · 1 comment
Open

combination of warnings, errors and hints can get confusing #5263

thaJeztah opened this issue Aug 19, 2024 · 1 comment

Comments

@thaJeztah
Copy link
Member

Related to #5240, where I made a mistake in my HEREDOC syntax. Just jotting it down here; not sure what the best output would look like, but I think the combination of errors, warnings, hints being intertwined can be confusing.

Looking back at that ticket, I also realize now that the expanded ("per line") output is not related to the linting, but to the error. I recall I initially used the wrong delimited (used EOF for both the Dockerfile and the RUN heredoc); the combination of a warning and error quickly gets confusing as they're all interleaved;

In this case

  • error (RUN failed)
  • X warnings found
  • summary of warning(s)
  • details about error
  • error (again)
  • hint (view build details)
docker build --progress=plain --no-cache -<<'EOF'
# syntax=docker/dockerfile:1

FROM alpine
RUN -<<'EOF'
env foo=bar
EOF
EOF

# .....
#9 [2/2] RUN -<<'EOF'
#9 0.116 /bin/sh: illegal option -<
#9 ERROR: process "/bin/sh -c -<<'EOF'" did not complete successfully: exit code: 2
------
 > [2/2] RUN -<<'EOF':
0.116 /bin/sh: illegal option -<
------

 1 warning found (use docker --debug to expand):
 - ConsistentInstructionCasing: Command 'env' should match the case of the command majority (uppercase) (line 5)
Dockerfile:4
--------------------
   2 |
   3 |     FROM alpine
   4 | >>> RUN -<<'EOF'
   5 |     env foo=bar
   6 |
--------------------
ERROR: failed to solve: process "/bin/sh -c -<<'EOF'" did not complete successfully: exit code: 2

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/aiqna4u2fi004x8x3qriz463i
bash: EOF: command not found

After "fixing" the EOF -> EOT mistake;

  • warnings found
  • summary of warnings
  • error-details
  • error
  • hint
docker build --progress=plain --no-cache -<<'EOF'
# syntax=docker/dockerfile:1

FROM alpine
RUN -<<'EOT'
env foo=bar
EOT
EOF

# .....
#3 CACHED

 1 warning found (use docker --debug to expand):
 - ConsistentInstructionCasing: Command 'env' should match the case of the command majority (uppercase) (line 5)
Dockerfile:6
--------------------
   4 |     RUN -<<'EOT'
   5 |     env foo=bar
   6 | >>> EOT
   7 |
--------------------
ERROR: failed to solve: dockerfile parse error on line 6: unknown instruction: EOT (did you mean ENV?)

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/lcjyf5gzycy3bedca61xnnysz

Without heredoc (on Docker Desktop with scout plugin installed);

  • hint
  • warnings found
  • summary of warnings
  • scout hint
docker build --progress=plain --no-cache -<<'EOF'
# syntax=docker/dockerfile:1

FROM alpine
RUN echo foo
env foo=bar
EOF

#8 DONE 0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/pdudz3dywoxrroyc77rekkztx

 1 warning found (use docker --debug to expand):
 - ConsistentInstructionCasing: Command 'env' should match the case of the command majority (uppercase) (line 5)

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview
@thaJeztah
Copy link
Member Author

cc @daghack (sorry the ticket is a bit random; it's mostly output from some things I was testing - hope it's still useful though 🙈)

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

No branches or pull requests

1 participant