Skip to content

Commit 2a347ee

Browse files
committed
prevent build updates from reverting the build phase
1 parent 03e7153 commit 2a347ee

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/build/registry/build/strategy.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"github.com/openshift/origin/pkg/build/api"
1515
"github.com/openshift/origin/pkg/build/api/validation"
16+
buildutil "github.com/openshift/origin/pkg/build/util"
1617
)
1718

1819
// strategy implements behavior for Build objects
@@ -94,7 +95,13 @@ type detailsStrategy struct {
9495
func (detailsStrategy) PrepareForUpdate(ctx kapi.Context, obj, old runtime.Object) {
9596
newBuild := obj.(*api.Build)
9697
oldBuild := old.(*api.Build)
97-
phase := newBuild.Status.Phase
98+
99+
// ignore phase updates unless the caller is updating the build to
100+
// a completed phase.
101+
phase := oldBuild.Status.Phase
102+
if buildutil.IsBuildComplete(newBuild) {
103+
phase = newBuild.Status.Phase
104+
}
98105
revision := newBuild.Spec.Revision
99106
message := newBuild.Status.Message
100107
reason := newBuild.Status.Reason

0 commit comments

Comments
 (0)