Skip to content

Commit

Permalink
Merge pull request #4720 from tonistiigi/parents-labs-handle-err
Browse files Browse the repository at this point in the history
dockerfile: don't silently ignore --parents if not labs
  • Loading branch information
tonistiigi authored Feb 29, 2024
2 parents 7de5894 + 95b9c4f commit 5872120
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontend/dockerfile/instructions/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,17 +334,20 @@ func parseCopy(req parseRequest) (*CopyCommand, error) {
}

var flExcludes *Flag
var flParents *Flag

// silently ignore if not -labs
if excludePatternsEnabled {
flExcludes = req.flags.AddStrings("exclude")
}
if parentsEnabled {
flParents = req.flags.AddBool("parents", false)
}

flChown := req.flags.AddString("chown", "")
flFrom := req.flags.AddString("from", "")
flChmod := req.flags.AddString("chmod", "")
flLink := req.flags.AddBool("link", false)
flParents := req.flags.AddBool("parents", false)

if err := req.flags.Parse(); err != nil {
return nil, err
}
Expand All @@ -361,7 +364,7 @@ func parseCopy(req parseRequest) (*CopyCommand, error) {
Chown: flChown.Value,
Chmod: flChmod.Value,
Link: flLink.Value == "true",
Parents: (flParents.Value == "true") && parentsEnabled, // silently ignore if not -labs
Parents: flParents != nil && flParents.Value == "true",
ExcludePatterns: stringValuesFromFlagIfPossible(flExcludes),
}, nil
}
Expand Down

0 comments on commit 5872120

Please sign in to comment.