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

Omit empty output object in BuildRun spec #1410

Merged
Show file tree
Hide file tree
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
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
2 changes: 1 addition & 1 deletion test/utils/v1beta1/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

func getImageURL(buildRun *buildv1beta1.BuildRun) string {
image := ""
if buildRun.Spec.Output.Image != "" {
if buildRun.Spec.Output != nil && buildRun.Spec.Output.Image != "" {
image = buildRun.Spec.Output.Image
} else {
image = buildRun.Status.BuildSpec.Output.Image
Expand Down