Do image export only if we have to generate the package

This commit is contained in:
Ettore Di Giacinto
2020-10-06 19:01:25 +02:00
parent 1c1bdca343
commit 0857e53b03

View File

@@ -318,8 +318,10 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
}
}
if err = cs.Backend.ExportImage(builderOpts); err != nil {
return nil, errors.Wrap(err, "Could not export image")
if generateArtifact {
if err = cs.Backend.ExportImage(builderOpts); err != nil {
return nil, errors.Wrap(err, "Could not export image")
}
}
if !cs.Options.KeepImageExport {
@@ -354,8 +356,10 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
}
}
if err := cs.Backend.ExportImage(runnerOpts); err != nil {
return nil, errors.Wrap(err, "Failed exporting image")
if generateArtifact {
if err := cs.Backend.ExportImage(runnerOpts); err != nil {
return nil, errors.Wrap(err, "Failed exporting image")
}
}
if !cs.Options.KeepImageExport {