Parser errors on dockerfiles without instructions
See https://github.com/moby/moby/pull/38487 for more discussion.
Signed-off-by: Natasha Jarus <linuxmercedes@gmail.com>
(cherry picked from commit 2ec7d53b00
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
docker-18.09^2
parent
ed4da8b4a9
commit
045e3a24dd
|
@ -275,6 +275,11 @@ func Parse(rwc io.Reader) (*Result, error) {
|
|||
if len(warnings) > 0 {
|
||||
warnings = append(warnings, "[WARNING]: Empty continuation lines will become errors in a future release.")
|
||||
}
|
||||
|
||||
if root.StartLine < 0 {
|
||||
return nil, errors.New("file with no instructions.")
|
||||
}
|
||||
|
||||
return &Result{
|
||||
AST: root,
|
||||
Warnings: warnings,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Hello
|
||||
# These are just comments
|
||||
|
Loading…
Reference in New Issue