Skip to content

Commit

Permalink
some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
qu1queee committed Jan 23, 2024
1 parent d1c9144 commit fa1f8e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions pkg/apis/build/v1beta1/buildrun_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,20 @@ func (src *BuildRun) ConvertTo(ctx context.Context, obj *unstructured.Unstructur
})
}

// BuildRun Status
sourceStatus := []v1alpha1.SourceResult{}

if src.Status.Source != nil && src.Status.Source.Git != nil {
// Note: v1alpha contains a Name field under the SourceResult
// object, which we dont set here.
sourceStatus = append(sourceStatus, v1alpha1.SourceResult{
Git: (*v1alpha1.GitSourceResult)(src.Status.Source.Git),
})
}

if src.Status.Source != nil && src.Status.Source.OciArtifact != nil {
// Note: v1alpha contains a Name field under the SourceResult
// object, which we dont set here.
sourceStatus = append(sourceStatus, v1alpha1.SourceResult{
Bundle: (*v1alpha1.BundleSourceResult)(src.Status.Source.OciArtifact),
})
Expand Down Expand Up @@ -144,6 +149,8 @@ func (src *BuildRun) ConvertTo(ctx context.Context, obj *unstructured.Unstructur
CompletionTime: src.Status.CompletionTime,
}

// Note: .Status.FailedAt is deprecated, so we do not
// convert it, only .Status.FailureDetails
if src.Status.FailureDetails != nil {
alphaBuildRun.Status.FailureDetails = &v1alpha1.FailureDetails{
Reason: src.Status.FailureDetails.Reason,
Expand Down
2 changes: 2 additions & 0 deletions pkg/reconciler/buildrun/resources/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ func UpdateBuildRunUsingTaskResults(
taskRunResult []pipelineapi.TaskRunResult,
request reconcile.Request,
) {
// Initializing source result
buildRun.Status.Source = &build.SourceResult{}

// Set source results
updateBuildRunStatusWithSourceResult(buildRun, taskRunResult)

Expand Down
10 changes: 6 additions & 4 deletions pkg/reconciler/buildrun/resources/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ func isLocalCopyBuildSource(
buildRun *buildv1beta1.BuildRun,
) *buildv1beta1.Local {

if buildRun.Spec.Source != nil && buildRun.Spec.Source.Type == buildv1beta1.LocalType {
return buildRun.Spec.Source.LocalSource
}

// Note: In v1alpha1 we will append all sources across builds and buildruns, and then return
// the first source of type Local.
if build.Spec.Source.Type == buildv1beta1.LocalType {
return build.Spec.Source.LocalSource
}

if buildRun.Spec.Source != nil && buildRun.Spec.Source.Type == buildv1beta1.LocalType {
return buildRun.Spec.Source.LocalSource
}

return nil
}

Expand Down

0 comments on commit fa1f8e8

Please sign in to comment.