Skip to content

Commit

Permalink
Omit empty output object in BuildRun spec
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaSchwarze0 committed Oct 18, 2023
1 parent f8a2b63 commit f5ef32c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
17 changes: 9 additions & 8 deletions pkg/apis/build/v1beta1/buildrun_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,17 @@ func (dest *BuildRunSpec) ConvertFrom(orig *v1alpha1.BuildRunSpec) error {
dest.ParamValues = append(dest.ParamValues, param)
}

// Handle BuildSpec Output
dest.Output = &Image{}
// Handle BuildRunSpec Output
if orig.Output != nil {
dest.Output.Image = orig.Output.Image
dest.Output.Annotations = orig.Output.Annotations
dest.Output.Labels = orig.Output.Labels
}
dest.Output = &Image{
Image: orig.Output.Image,
Annotations: orig.Output.Annotations,
Labels: orig.Output.Labels,
}

if orig.Output != nil && orig.Output.Credentials != nil {
dest.Output.PushSecret = &orig.Output.Credentials.Name
if orig.Output.Credentials != nil {
dest.Output.PushSecret = &orig.Output.Credentials.Name
}
}

// BuildRunSpec State
Expand Down
1 change: 0 additions & 1 deletion pkg/webhook/conversion/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,6 @@ request:
},
},
},
Output: &v1beta1.Image{},
},
}

Expand Down

0 comments on commit f5ef32c

Please sign in to comment.