Merge pull request #4 from mzihlmann/add-labels-on-last-image

fix: intermediate images should not be labelled
This commit is contained in:
mzihlmann 2025-05-24 21:05:23 +01:00 committed by GitHub
commit b34d005c0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -772,6 +772,9 @@ func DoBuild(opts *config.KanikoOptions) (v1.Image, error) {
configFile.OS = strings.Split(opts.CustomPlatform, "/")[0]
configFile.Architecture = strings.Split(opts.CustomPlatform, "/")[1]
}
if !stage.Final {
configFile.Config.Labels = map[string]string{}
}
sourceImage, err = mutate.ConfigFile(sourceImage, configFile)
if err != nil {
return nil, err