Skip to content

Commit

Permalink
Add UID label to PipelineRun and TaskRun
Browse files Browse the repository at this point in the history
  • Loading branch information
khrm committed Jun 30, 2024
1 parent ba287f5 commit 75b152d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/apis/pipeline/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ const (
// TaskRunLabelKey is used as the label identifier for a TaskRun
TaskRunLabelKey = GroupName + "/taskRun"

// TaskRunLabelKey is used as the label identifier for a TaskRun
TaskRunUIDLabelKey = GroupName + "/taskRunUID"

// PipelineLabelKey is used as the label identifier for a Pipeline
PipelineLabelKey = GroupName + "/pipeline"

// PipelineRunLabelKey is used as the label identifier for a PipelineRun
PipelineRunLabelKey = GroupName + "/pipelineRun"

// PipelineRunLabelKey is used as the label identifier for a PipelineRun
PipelineRunUIDLabelKey = GroupName + "/pipelineRunUID"

// PipelineTaskLabelKey is used as the label identifier for a PipelineTask
PipelineTaskLabelKey = GroupName + "/pipelineTask"

Expand Down
1 change: 1 addition & 0 deletions pkg/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ func makeLabels(s *v1.TaskRun) map[string]string {
// NB: Set this *after* passing through TaskRun Labels. If the TaskRun
// specifies this label, it should be overridden by this value.
labels[pipeline.TaskRunLabelKey] = s.Name
labels[pipeline.TaskRunUIDLabelKey] = string(s.UID)
return labels
}

Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,7 @@ func getTaskrunLabels(pr *v1.PipelineRun, pipelineTaskName string, includePipeli
}
}
labels[pipeline.PipelineRunLabelKey] = pr.Name
labels[pipeline.PipelineRunUIDLabelKey] = string(pr.UID)
if pipelineTaskName != "" {
labels[pipeline.PipelineTaskLabelKey] = pipelineTaskName
}
Expand Down

0 comments on commit 75b152d

Please sign in to comment.