Skip to content

Commit

Permalink
Merge pull request #1410 from SaschaSchwarze0/sascha-fix-buildrun-spe…
Browse files Browse the repository at this point in the history
…c-output

Omit empty output object in BuildRun spec
  • Loading branch information
openshift-ci[bot] authored Oct 19, 2023
2 parents f8a2b63 + c2f155d commit afb4bdc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 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
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

0 comments on commit afb4bdc

Please sign in to comment.