Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent build updates from reverting the build phase #13075

Merged
merged 1 commit into from
Feb 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/build/registry/build/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/openshift/origin/pkg/build/api"
"github.com/openshift/origin/pkg/build/api/validation"
buildutil "github.com/openshift/origin/pkg/build/util"
)

// strategy implements behavior for Build objects
Expand Down Expand Up @@ -94,7 +95,13 @@ type detailsStrategy struct {
func (detailsStrategy) PrepareForUpdate(ctx kapi.Context, obj, old runtime.Object) {
newBuild := obj.(*api.Build)
oldBuild := old.(*api.Build)
phase := newBuild.Status.Phase

// ignore phase updates unless the caller is updating the build to
// a completed phase.
phase := oldBuild.Status.Phase
if buildutil.IsBuildComplete(newBuild) {
phase = newBuild.Status.Phase
}
revision := newBuild.Spec.Revision
message := newBuild.Status.Message
reason := newBuild.Status.Reason
Expand Down