Skip to content

Commit

Permalink
Parser errors on dockerfiles without instructions
Browse files Browse the repository at this point in the history
See moby/moby#38487 for more discussion.

Signed-off-by: Natasha Jarus <[email protected]>
  • Loading branch information
LinuxMercedes committed Jan 4, 2019
1 parent c471ab8 commit 2ec7d53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/dockerfile/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Hello
# These are just comments

0 comments on commit 2ec7d53

Please sign in to comment.