imagebuildah: return the right stage's image as the "final" image
When building multiple stages, we weren't ensuring that the image reference we returned to our caller was a reference to the final image we built. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
parent
d2e0cd8988
commit
215536fb4b
|
@ -531,19 +531,19 @@ func (b *Executor) Build(ctx context.Context, stages imagebuilder.Stages) (image
|
|||
go func() {
|
||||
defer b.stagesSemaphore.Release(1)
|
||||
defer wg.Done()
|
||||
imageID, ref, err = b.buildStage(ctx, cleanupStages, stages, index)
|
||||
if err != nil {
|
||||
stageID, stageRef, stageErr := b.buildStage(ctx, cleanupStages, stages, index)
|
||||
if stageErr != nil {
|
||||
ch <- Result{
|
||||
Index: index,
|
||||
Error: err,
|
||||
Error: stageErr,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
ch <- Result{
|
||||
Index: index,
|
||||
ImageID: imageID,
|
||||
Ref: ref,
|
||||
ImageID: stageID,
|
||||
Ref: stageRef,
|
||||
Error: nil,
|
||||
}
|
||||
}()
|
||||
|
@ -579,6 +579,7 @@ func (b *Executor) Build(ctx context.Context, stages imagebuilder.Stages) (image
|
|||
}
|
||||
if r.Index == len(stages)-1 {
|
||||
imageID = r.ImageID
|
||||
ref = r.Ref
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue