Merge pull request #1252 from tejal29/fix_double_save

remove duplicates save for the same dir
This commit is contained in:
Tejal Desai 2020-05-07 18:27:08 -07:00 committed by GitHub
commit f5e23579a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -710,7 +710,16 @@ func filesToSave(deps []string) ([]string, error) {
srcFiles = append(srcFiles, f)
}
}
return srcFiles, nil
// remove duplicates
deduped := []string{}
m := map[string]struct{}{}
for _, f := range srcFiles {
if _, ok := m[f]; !ok {
deduped = append(deduped, f)
m[f] = struct{}{}
}
}
return deduped, nil
}
func fetchExtraStages(stages []config.KanikoStage, opts *config.KanikoOptions) error {