-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Pipeline Label to pipelineRun and tasksRun #69
Comments
One thing I'm wondering from this description is what the purpose of the labels are? e.g. what use cases do you need labels in (part of this is probably me not being too familiar with labels!) |
One example is the |
Are you also thinking of adding PipelineRun label to TaskRun in this task? |
It would make sense to add the |
Okay I looked into our options a bit about how to reference child resources (e.g. a
LabelsInside a controller we can use the informer's // Try getting the related TaskRuns by label, using the name of this PipelineRun
selector := labels.SelectorFromSet(map[string]string{"knative.dev/pipelinerun": key})
taskRuns, err := c.taskRunLister.TaskRuns(namespace).List(selector)
if err != nil {
c.Logger.Errorf("Error retrieving TaskRuns by label for %s", key)
} else {
for _, tr := range taskRuns {
c.Logger.Infof("THIS IS MY TASK RUN %v", tr.GetName())
}
} OwnerReferencesAs far as I can tell it's not possible to query for all objects with a particular owner reference. I found these two thread requesting this feature:
Which is unfortunate since this is pretty much exactly what we're looking for! ObjectReferencesI completely forgot that in our The go type is a bit incomplete, but in the yaml you can see what we were getting at: Names
So we could query for the child resources by name, though it seems that fuzzy or regex based searching isn't clearly possible (apparently kubernetes/kubernetes#9248 (comment) that's what labels are for 🤣) - even though it is actually supported by the describe command. @tejal29 pointed out there is some complication here tho - what do we want to do if the same ConclusionI suggest that when retrieving child resources in the I think sticking to using the same name for the But as @pivotal-nader-ziada pointed out, it can be handy for the controllers when logging to know about what created them, and @tejal29 also pointed out it's handy on the command line to retrieve all related
I'll add these to the existing controllers as they get to the point where they can be added, unless they are added by folks working on those controllers before I get a chance. (let me know if you want any more added!) |
I'm gonna unassign myself from this since I haven't gotten a chance to work on it: the work to do here is to add the labels as described in the previous comment. |
Adds labels to TaskRuns created by PipelineRuns as well as Builds that are created. In TaskRuns and Builds will have labels set telling which Pipeline, PipelineRun and TaskRun are the owners of it. This is useful when doing filtering in searches. Fixes tektoncd#69
Adds labels to TaskRuns created by PipelineRuns as well as Builds that are created. In TaskRuns and Builds will have labels set telling which Pipeline, PipelineRun and TaskRun are the owners of it. This is useful when doing filtering in searches. Fixes tektoncd#69
Adds labels to TaskRuns created by PipelineRuns as well as Builds that are created. In TaskRuns and Builds will have labels set telling which Pipeline, PipelineRun and TaskRun are the owners of it. This is useful when doing filtering in searches. Fixes tektoncd#69
/assign @tanner-bruce |
@vdemeester: GitHub didn't allow me to assign the following users: tanner-bruce. Note that only knative members and repo collaborators can be assigned. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Adds labels to TaskRuns created by PipelineRuns as well as Builds that are created. In TaskRuns and Builds will have labels set telling which Pipeline, PipelineRun and TaskRun are the owners of it. This is useful when doing filtering in searches. Fixes tektoncd#69
Adds labels to TaskRuns created by PipelineRuns as well as Builds that are created. In TaskRuns and Builds will have labels set telling which Pipeline, PipelineRun and TaskRun are the owners of it. This is useful when doing filtering in searches. Fixes tektoncd#69
Adds labels to TaskRuns created by PipelineRuns as well as Builds that are created. In TaskRuns and Builds will have labels set telling which Pipeline, PipelineRun and TaskRun are the owners of it. This is useful when doing filtering in searches. Fixes #69
Sample for tektoncd#69
Expected Behavior
The
PipelineRun
andTasksRun
object should have a label with the pipeline name. Can be calledknative.dev/pipeline
with a value of the actual pipeline name.The TaskRun controller can use the Pipeline name in Pod metadata and log messages.
Actual Behavior
Currently there are no labels added
Additional Info
Task
name label on theTaskRun
?The text was updated successfully, but these errors were encountered: