Skip to content

Commit eedd08a

Browse files
author
Victor
committed
fix the status and reason assignment
1 parent 29b3f65 commit eedd08a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: pkg/build/registry/build/strategy.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -110,27 +110,27 @@ type detailsStrategy struct {
110110
}
111111

112112
// Prepares a build for update by only allowing an update to build details.
113-
// build details currently consists of: Spec.Revision, Status.Reason, and
113+
// Build details currently consists of: Spec.Revision, Status.Reason, and
114114
// Status.Message, all of which are updated from within the build pod
115115
func (detailsStrategy) PrepareForUpdate(obj, old runtime.Object) {
116116
newBuild := obj.(*api.Build)
117117
oldBuild := old.(*api.Build)
118118
revision := newBuild.Spec.Revision
119-
oldReason := oldBuild.Status.Reason
120-
oldMessage := oldBuild.Status.Message
119+
message := newBuild.Status.Message
120+
reason := newBuild.Status.Reason
121121
*newBuild = *oldBuild
122122
newBuild.Spec.Revision = revision
123-
newBuild.Status.Reason = oldReason
124-
newBuild.Status.Message = oldMessage
123+
newBuild.Status.Reason = reason
124+
newBuild.Status.Message = message
125125
}
126126

127127
// Validates that an update is valid by ensuring that no Revision exists and that it's not getting updated to blank
128128
func (detailsStrategy) ValidateUpdate(ctx kapi.Context, obj, old runtime.Object) field.ErrorList {
129129
newBuild := obj.(*api.Build)
130130
oldBuild := old.(*api.Build)
131-
errors := field.ErrorList{}
132131
oldRevision := oldBuild.Spec.Revision
133132
newRevision := newBuild.Spec.Revision
133+
errors := field.ErrorList{}
134134

135135
if newRevision == nil {
136136
errors = append(errors, field.Invalid(field.NewPath("spec", "revision"), nil, "cannot set an empty revision in build spec"))

0 commit comments

Comments
 (0)