Skip to content

Commit

Permalink
Patch pipeline name label with GroupName to avoid back compat change …
Browse files Browse the repository at this point in the history
…in 0.27

The pipeline name label propagation change in 2a910a3 was merged after a slight
change in the way we construct some publicly exported label constants. Bringing
in the change to public constants would have technically been breaking for a
patch release.

This reintroduces GroupName to the label construction when propagating the
pipeline name label to workaround the conflict.
  • Loading branch information
Scott authored and tekton-robot committed Aug 23, 2021
1 parent 5ee0dc9 commit e297768
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,9 +943,9 @@ func propagatePipelineNameLabelToPipelineRun(pr *v1beta1.PipelineRun) error {
}
switch {
case pr.Spec.PipelineRef != nil && pr.Spec.PipelineRef.Name != "":
pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = pr.Spec.PipelineRef.Name
pr.ObjectMeta.Labels[pipeline.GroupName+pipeline.PipelineLabelKey] = pr.Spec.PipelineRef.Name
case pr.Spec.PipelineSpec != nil:
pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = pr.Name
pr.ObjectMeta.Labels[pipeline.GroupName+pipeline.PipelineLabelKey] = pr.Name
default:
return fmt.Errorf("pipelineRun %s not providing PipelineRef or PipelineSpec", pr.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/pipelinerun/pipelinerun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2586,7 +2586,7 @@ func TestReconcileCancelledFailsTaskRunCancellation(t *testing.T) {
t.Fatalf("Somehow had error getting reconciled run out of fake client: %s", err)
}

if val, ok := reconciledRun.GetLabels()[pipeline.PipelineLabelKey]; !ok {
if val, ok := reconciledRun.GetLabels()[pipeline.GroupName+pipeline.PipelineLabelKey]; !ok {
t.Fatalf("expected pipeline label")
if d := cmp.Diff("test-pipelines", val); d != "" {
t.Errorf("expected to see pipeline label. Diff %s", diff.PrintWantGot(d))
Expand Down

0 comments on commit e297768

Please sign in to comment.