Skip to content
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

implementing TEP-0150 - displayName in childReferences #7683

Merged

Conversation

pritidesai
Copy link
Member

@pritidesai pritidesai commented Feb 16, 2024

Changes

Implementing proposal TEP-0150.

Adding a functionality where the existing displayName can be used to configure unique names for each instance using the params from each combination such that the matrix instances in the Tekton Dashboard are rendered to distinguishable names.

Also, repurposing an existing name field as part of the matrix.include[].name. If specified, a fully resolved name field is available in the childReferences.

Fixes #7082

/kind feature

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

A fully resolved displayName is now available in childReferences along with the pipelineTaskName. This is mainly beneficial to parameterize and easily distinguish matrix instances of the task. 

@tekton-robot tekton-robot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Feb 16, 2024
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Feb 16, 2024
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@pritidesai pritidesai force-pushed the displayName-in-matrix-single-api branch from bb37fc9 to b84b8a2 Compare February 17, 2024 00:27
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@pritidesai pritidesai added this to the Pipelines v0.58 milestone Feb 21, 2024
@pritidesai pritidesai force-pushed the displayName-in-matrix-single-api branch from b84b8a2 to c6a0bed Compare February 22, 2024 17:11
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.7% 98.4% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.7% 98.4% -0.3
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@pritidesai pritidesai force-pushed the displayName-in-matrix-single-api branch from c6a0bed to d5256ea Compare February 22, 2024 18:00
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.7% 98.7% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.7% 98.7% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@afrittoli
Copy link
Member

/test pull-tekton-pipeline-integration-tests

@pritidesai
Copy link
Member Author

The display name here (and in the next ones) seems to be related to how a specific matrix combination was extended through the matrix.include section. Some are only extended with common-package so they all that name. the the common-package include did not exists, would they have an empty displayName?

Thanks @afrittoli! That is correct. The displayName in childReferences will have the matrix.include[].name only for the combinations which were added as part of that include otherwise the displayName is not initialized. For the names from multiple include sections, we are concatenating them with a space. Any specific comment/feedback on that?

@afrittoli
Copy link
Member

The display name here (and in the next ones) seems to be related to how a specific matrix combination was extended through the matrix.include section. Some are only extended with common-package so they all that name. the the common-package include did not exists, would they have an empty displayName?

Thanks @afrittoli! That is correct. The displayName in childReferences will have the matrix.include[].name only for the combinations which were added as part of that include otherwise the displayName is not initialized. For the names from multiple include sections, we are concatenating them with a space. Any specific comment/feedback on that?

Thanks @pritidesai. I think concatenation makes sense. As I mentioned, I find the current matrix API a bit hard to parse, but that's not something for this to address. Given the current matrix API, the proposed display name makes sense. Perhaps we should have one case in the test list where display name remains empty to check that case too?

@pritidesai pritidesai force-pushed the displayName-in-matrix-single-api branch from d5256ea to 4fbb1e5 Compare February 28, 2024 17:17
@pritidesai
Copy link
Member Author

Thanks @pritidesai. I think concatenation makes sense. As I mentioned, I find the current matrix API a bit hard to parse, but that's not something for this to address. Given the current matrix API, the proposed display name makes sense. Perhaps we should have one case in the test list where display name remains empty to check that case too?

We have a variety of tests written under pipelinerunstate_test.go which include the case where the displayName remains empty when include params does not make it as part of the combinations:

https://github.com/tektoncd/pipeline/pull/7683/files#diff-22f0dfe65e555d6833c559a7a03613fa9cfec74ddf0962109a8b7ed810ccc850R4014-R4021

Let me know if we want to add more tests. Thanks!

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.5% 98.5% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.5% 98.5% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@pritidesai
Copy link
Member Author

/retest

Hey @AlanGreene @AverageMarcus, this is ready for review, PTAL! Thanks!

@pritidesai
Copy link
Member Author

/retest

1 similar comment
@pritidesai
Copy link
Member Author

/retest

@chitrangpatel
Copy link
Contributor

Pipeline WG: @AlanGreene @AverageMarcus PTAL again since we are hoping to get this merged this month.

Copy link
Contributor

@AverageMarcus AverageMarcus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot
Copy link
Collaborator

@AverageMarcus: changing LGTM is restricted to collaborators

In response to this:

/lgtm

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.

Copy link
Member

@AlanGreene AlanGreene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pipeline WG: @AlanGreene @AverageMarcus PTAL again since we are hoping to get this merged this month.

The latest updates to the docs and examples look good based on our discussions and previous feedback, and as far as I can tell the test updates make sense too.

However, I'm not familiar enough with the codebase to determine whether the implementation has any potential impact on other features / functionality, in particular the changes in ApplyReplacements. A Pipelines maintainer or contributor would need to review and comment on that.

pkg/reconciler/pipelinerun/resources/pipelinerunstate.go Outdated Show resolved Hide resolved
@pritidesai pritidesai force-pushed the displayName-in-matrix-single-api branch from 4fbb1e5 to 39daaf7 Compare March 5, 2024 18:22
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.5% 98.5% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 98.5% 98.5% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@pritidesai
Copy link
Member Author

@tektoncd/core-maintainers please help review this PR. Thanks in advance!

@pritidesai
Copy link
Member Author

This is a very simple change in adding human readable name in the childReferences. As an end user, we are waiting for this feature. Will appreciate if we can get the community to review on this PR. Thanks in advance!

Implementing proposal TEP-0150.

Adding a functionality where the existing displayName can be used to configure
unique names for each instance using the params from each combination such that
the matrix instances in the Tekton Dashboard are rendered to distinguishable
names.

Also, repurposing an existing name field as part of the matrix.include[].name.
If specified, a fully resolved name field is available in the childReferences.

Signed-off-by: Priti Desai <pdesai@us.ibm.com>
@pritidesai pritidesai force-pushed the displayName-in-matrix-single-api branch from 39daaf7 to a9f4b61 Compare March 11, 2024 18:22
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 95.7% 0.0
pkg/reconciler/pipelinerun/resources/apply.go 98.5% 98.5% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@chitrangpatel
Copy link
Contributor

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chitrangpatel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2024
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go 95.7% 95.7% 0.0
pkg/reconciler/pipelinerun/resources/apply.go 98.5% 98.5% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 99.5% 99.6% 0.1

@JeromeJu JeromeJu self-assigned this Mar 15, 2024
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pritidesai for the extra test and updates.
I only left a NIT comment, but nothing blocking really - maybe something for another PR.

/lgtm

docs/matrix.md Show resolved Hide resolved
Comment on lines +4103 to +4108
TypeMeta: runtime.TypeMeta{
APIVersion: "tekton.dev/v1",
Kind: "TaskRun",
},
Name: "matrixed-task-run-2",
PipelineTaskName: "matrixed-task",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@@ -240,8 +242,53 @@ func (facts *PipelineRunFacts) GetChildReferences() []v1.ChildStatusReference {
return childRefs
}

func (t *ResolvedPipelineTask) getDisplayName(customRun *v1beta1.CustomRun, taskRun *v1.TaskRun, c v1.ChildStatusReference) v1.ChildStatusReference {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: I find the name/structure of this function slightly confusing - it does not return the display name, instead it sets it on a ChildStatusReference that must be passed as input.

Since the ChildStatusReference is not used to build the displayName, I thought it would be better to have a getDisplayName function that returns a string - any particular reason for having it this way?

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 15, 2024
@tekton-robot tekton-robot merged commit 62cddf7 into tektoncd:main Mar 15, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable displayName for a Matrix TaskRun
7 participants