reject tarball writes with no destinations (#1534)

* reject tarball writes with no destinations

* Update pkg/snapshot/snapshot.go

Co-authored-by: Tejal Desai <tejal29@gmail.com>
This commit is contained in:
Josh Chorlton 2021-01-03 18:13:05 +00:00 committed by GitHub
parent 397912d96c
commit ece215c181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -217,6 +217,11 @@ func DoPush(image v1.Image, opts *config.KanikoOptions) error {
if opts.TarPath != "" {
tagToImage := map[name.Tag]v1.Image{}
if len(destRefs) == 0 {
return errors.New("must provide at least one destination when tarPath is specified")
}
for _, destRef := range destRefs {
tagToImage[destRef] = image
}

View File

@ -169,7 +169,7 @@ func (s *Snapshotter) scanFullFilesystem() ([]string, []string, error) {
}
for _, path := range resolvedFiles {
if util.CheckIgnoreList(path) {
logrus.Tracef("Not adding %s to layer, as it's whitelisted", path)
logrus.Tracef("Not adding %s to layer, as it's ignored", path)
continue
}
filesToAdd = append(filesToAdd, path)