Skip to content

Commit

Permalink
Remove tekton.dev/task label from taskrun of clustertasks
Browse files Browse the repository at this point in the history
This will remove the label tekton.dev/task label from taskruns which
are referencing a clusterTask. This was marked deprecated in v0.12.0

Fix #2533
  • Loading branch information
piyush-garg authored and tekton-robot committed Mar 9, 2021
1 parent b8fbac4 commit ee1c2d6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions docs/labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ Tekton automatically adds labels to Tekton entities as described in the followin
</tbody>
</table>

**Note:** For backward compatibility, `TaskRuns` that reference a `ClusterTask` also get the `tekton.dev/task` label.

## Usage examples

Below are some examples of using labels:
Expand Down
3 changes: 2 additions & 1 deletion pkg/reconciler/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,10 @@ func (c *Reconciler) prepare(ctx context.Context, tr *v1beta1.TaskRun) (*v1beta1
tr.ObjectMeta.Labels[key] = value
}
if tr.Spec.TaskRef != nil {
tr.ObjectMeta.Labels[pipeline.GroupName+pipeline.TaskLabelKey] = taskMeta.Name
if tr.Spec.TaskRef.Kind == "ClusterTask" {
tr.ObjectMeta.Labels[pipeline.GroupName+pipeline.ClusterTaskLabelKey] = taskMeta.Name
} else {
tr.ObjectMeta.Labels[pipeline.GroupName+pipeline.TaskLabelKey] = taskMeta.Name
}
}

Expand Down
1 change: 0 additions & 1 deletion pkg/reconciler/taskrun/taskrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,6 @@ func TestReconcile(t *testing.T) {
wantPod: tb.Pod("test-taskrun-with-cluster-task-pod-abcde",
tb.PodNamespace("foo"),
tb.PodAnnotation(podconvert.ReleaseAnnotation, version.PipelineVersion),
tb.PodLabel(taskNameLabelKey, "test-cluster-task"),
tb.PodLabel(clusterTaskNameLabelKey, "test-cluster-task"),
tb.PodLabel(taskRunNameLabelKey, "test-taskrun-with-cluster-task"),
tb.PodLabel("app.kubernetes.io/managed-by", "tekton-pipelines"),
Expand Down

0 comments on commit ee1c2d6

Please sign in to comment.