diff --git a/go.mod b/go.mod index 1e0cf5faa..b2a2f250f 100644 --- a/go.mod +++ b/go.mod @@ -56,7 +56,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/tektoncd/chains v0.14.0 github.com/tektoncd/hub v1.11.1 - github.com/tektoncd/pipeline v0.43.1 + github.com/tektoncd/pipeline v0.43.2 github.com/tektoncd/plumbing v0.0.0-20221102182345-5dbcfda657d7 github.com/tektoncd/triggers v0.22.0 github.com/theupdateframework/go-tuf v0.5.2-0.20220930112810-3890c1e7ace4 diff --git a/go.sum b/go.sum index 2ac48c8d7..075cd547e 100644 --- a/go.sum +++ b/go.sum @@ -3287,8 +3287,8 @@ github.com/tektoncd/hub v1.11.1 h1:ec1Q0twM2VTwKnZT5n1U/x+2JKC8wrESbRPPWHyGLEc= github.com/tektoncd/hub v1.11.1/go.mod h1:6pCq7zMVlQhqVMEmKme9fc9CYnEDxqWr5xIFVTUvRUE= github.com/tektoncd/pipeline v0.41.0/go.mod h1:YY4+PGfdsd6Qxn3PZXmCpKeS3heK8pIIcnUt37vRJ2Q= github.com/tektoncd/pipeline v0.42.0/go.mod h1:AsKKcVxseE/VxA28hgXJ/JO/L3yl60jlegDgDUCSNXE= -github.com/tektoncd/pipeline v0.43.1 h1:+ZQLzjDfhTvt5KNwAary3r/DADEcAtbW5HcdIaY4WwQ= -github.com/tektoncd/pipeline v0.43.1/go.mod h1:KEnQsGxxeK7UjVMzVt62CEa7VZ6GUuMJfUHAaEpVP+E= +github.com/tektoncd/pipeline v0.43.2 h1:4ia0gBE7YEcbclbI7yO4rwNH37IhxOhfI/cSs89qdm8= +github.com/tektoncd/pipeline v0.43.2/go.mod h1:KEnQsGxxeK7UjVMzVt62CEa7VZ6GUuMJfUHAaEpVP+E= github.com/tektoncd/plumbing v0.0.0-20220817140952-3da8ce01aeeb/go.mod h1:uJBaI0AL/kjPThiMYZcWRujEz7D401v643d6s/21GAg= github.com/tektoncd/plumbing v0.0.0-20221102182345-5dbcfda657d7 h1:YsjQ83UBIIq4k/s2PzQ6pqe4tpPtm1hia3oyNBDDrDU= github.com/tektoncd/plumbing v0.0.0-20221102182345-5dbcfda657d7/go.mod h1:uJBaI0AL/kjPThiMYZcWRujEz7D401v643d6s/21GAg= diff --git a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go index cd3226623..6b4331608 100644 --- a/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go +++ b/vendor/github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go @@ -20,6 +20,7 @@ import ( "context" "fmt" + "github.com/tektoncd/pipeline/pkg/apis/config" v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" "github.com/tektoncd/pipeline/pkg/apis/version" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -54,7 +55,7 @@ func (pr *PipelineRun) ConvertTo(ctx context.Context, to apis.Convertible) error if err := serializePipelineRunStatusRuns(&sink.ObjectMeta, &pr.Status); err != nil { return err } - if err := pr.Status.ConvertTo(ctx, &sink.Status); err != nil { + if err := pr.Status.convertTo(ctx, &sink.Status); err != nil { return err } return pr.Spec.ConvertTo(ctx, &sink.Spec) @@ -117,13 +118,15 @@ func (pr *PipelineRun) ConvertFrom(ctx context.Context, from apis.Convertible) e if err := deserializePipelineRunResources(&pr.ObjectMeta, &pr.Spec); err != nil { return err } - if err := deserializePipelineRunStatusTaskRuns(&pr.ObjectMeta, &pr.Status); err != nil { + taskRuns, err := deserializePipelineRunStatusTaskRuns(&pr.ObjectMeta) + if err != nil { return err } - if err := deserializePipelineRunStatusRuns(&pr.ObjectMeta, &pr.Status); err != nil { + runs, err := deserializePipelineRunStatusRuns(&pr.ObjectMeta) + if err != nil { return err } - if err := pr.Status.ConvertFrom(ctx, &source.Status); err != nil { + if err := pr.Status.convertFrom(ctx, &source.Status, taskRuns, runs); err != nil { return err } return pr.Spec.ConvertFrom(ctx, &source.Spec) @@ -235,8 +238,7 @@ func (ptrs *PipelineTaskRunSpec) convertFrom(ctx context.Context, source v1.Pipe ptrs.ComputeResources = source.ComputeResources } -// ConvertTo implements apis.Convertible -func (prs *PipelineRunStatus) ConvertTo(ctx context.Context, sink *v1.PipelineRunStatus) error { +func (prs *PipelineRunStatus) convertTo(ctx context.Context, sink *v1.PipelineRunStatus) error { sink.Status = prs.Status sink.StartTime = prs.StartTime sink.CompletionTime = prs.CompletionTime @@ -271,6 +273,7 @@ func (prs *PipelineRunStatus) ConvertTo(ctx context.Context, sink *v1.PipelineRu prs.Provenance.convertTo(ctx, &new) sink.Provenance = &new } + // If embedded-status is set to "both", both ChildReferences and TaskRuns/Runs // will be populated. In this case, use the value from ChildReferences. if sink.ChildReferences == nil { @@ -284,8 +287,7 @@ func (prs *PipelineRunStatus) ConvertTo(ctx context.Context, sink *v1.PipelineRu return nil } -// ConvertFrom implements apis.Convertible -func (prs *PipelineRunStatus) ConvertFrom(ctx context.Context, source *v1.PipelineRunStatus) error { +func (prs *PipelineRunStatus) convertFrom(ctx context.Context, source *v1.PipelineRunStatus, taskRuns map[string]*PipelineRunTaskRunStatus, runs map[string]*PipelineRunRunStatus) error { prs.Status = source.Status prs.StartTime = source.StartTime prs.CompletionTime = source.CompletionTime @@ -309,12 +311,20 @@ func (prs *PipelineRunStatus) ConvertFrom(ctx context.Context, source *v1.Pipeli new.convertFrom(ctx, st) prs.SkippedTasks = append(prs.SkippedTasks, new) } - prs.ChildReferences = nil - for _, cr := range source.ChildReferences { - new := ChildStatusReference{} - new.convertFrom(ctx, cr) - prs.ChildReferences = append(prs.ChildReferences, new) + embeddedStatus := config.FromContextOrDefaults(ctx).FeatureFlags.EmbeddedStatus + if embeddedStatus == config.BothEmbeddedStatus || embeddedStatus == config.MinimalEmbeddedStatus { + prs.ChildReferences = nil + for _, cr := range source.ChildReferences { + new := ChildStatusReference{} + new.convertFrom(ctx, cr) + prs.ChildReferences = append(prs.ChildReferences, new) + } + } + if embeddedStatus == config.BothEmbeddedStatus || embeddedStatus == config.FullEmbeddedStatus { + prs.TaskRuns = taskRuns + prs.Runs = runs } + prs.FinallyStartTime = source.FinallyStartTime if source.Provenance != nil { new := Provenance{} @@ -453,16 +463,13 @@ func serializePipelineRunStatusTaskRuns(meta *metav1.ObjectMeta, status *Pipelin return version.SerializeToMetadata(meta, status.TaskRuns, taskRunsAnnotationKey) } -func deserializePipelineRunStatusTaskRuns(meta *metav1.ObjectMeta, status *PipelineRunStatus) error { +func deserializePipelineRunStatusTaskRuns(meta *metav1.ObjectMeta) (map[string]*PipelineRunTaskRunStatus, error) { taskRuns := make(map[string]*PipelineRunTaskRunStatus) err := version.DeserializeFromMetadata(meta, &taskRuns, taskRunsAnnotationKey) if err != nil { - return err + return nil, err } - if len(taskRuns) != 0 { - status.TaskRuns = taskRuns - } - return nil + return taskRuns, nil } func serializePipelineRunStatusRuns(meta *metav1.ObjectMeta, status *PipelineRunStatus) error { @@ -472,14 +479,11 @@ func serializePipelineRunStatusRuns(meta *metav1.ObjectMeta, status *PipelineRun return version.SerializeToMetadata(meta, status.Runs, runsAnnotationKey) } -func deserializePipelineRunStatusRuns(meta *metav1.ObjectMeta, status *PipelineRunStatus) error { +func deserializePipelineRunStatusRuns(meta *metav1.ObjectMeta) (map[string]*PipelineRunRunStatus, error) { runs := make(map[string]*PipelineRunRunStatus) err := version.DeserializeFromMetadata(meta, &runs, runsAnnotationKey) if err != nil { - return err - } - if len(runs) != 0 { - status.Runs = runs + return nil, err } - return nil + return runs, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 834f26a55..4c72581fc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1401,7 +1401,7 @@ github.com/tektoncd/hub/api/v1/gen/http/catalog/client github.com/tektoncd/hub/api/v1/gen/http/resource/client github.com/tektoncd/hub/api/v1/gen/resource github.com/tektoncd/hub/api/v1/gen/resource/views -# github.com/tektoncd/pipeline v0.43.1 +# github.com/tektoncd/pipeline v0.43.2 ## explicit; go 1.18 github.com/tektoncd/pipeline/pkg/apis/config github.com/tektoncd/pipeline/pkg/apis/config/resolver