Skip to content

Commit

Permalink
imagebuildah.StageExecutor.Copy(): reject new flags for now
Browse files Browse the repository at this point in the history
Reject the new ADD --keep-git-dir, COPY --parents, and ADD/COPY --link
and ADD/COPY --exclude flags.  The behavior they ask for isn't
implemented (yet), and rejecting the flags outright is far preferable to
quietly ignoring them.

Signed-off-by: Nalin Dahyabhai <[email protected]>
  • Loading branch information
nalind committed Jun 26, 2024
1 parent a63fbba commit d6771f8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions imagebuildah/stage_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,26 @@ func (s *StageExecutor) volumeCacheRestore() error {
// Copy copies data into the working tree. The "Download" field is how
// imagebuilder tells us the instruction was "ADD" and not "COPY".
func (s *StageExecutor) Copy(excludes []string, copies ...imagebuilder.Copy) error {
for _, cp := range copies {
if cp.KeepGitDir {
if cp.Download {
return errors.New("ADD --keep-git-dir is not supported")
}
return errors.New("COPY --keep-git-dir is not supported")
}
if cp.Link {
return errors.New("COPY --link is not supported")
}
if cp.Parents {
return errors.New("COPY --parents is not supported")
}
if len(cp.Excludes) > 0 {
if cp.Download {
return errors.New("ADD --excludes is not supported")
}
return errors.New("COPY --excludes is not supported")
}
}
s.builder.ContentDigester.Restart()
return s.performCopy(excludes, copies...)
}
Expand Down

0 comments on commit d6771f8

Please sign in to comment.