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

Move bespoke functionality out of TaskRun API #5377

Merged
merged 3 commits into from
Aug 26, 2022

Conversation

xchapter7x
Copy link
Contributor

@xchapter7x xchapter7x commented Aug 25, 2022

The TaskRun API was maintaining a isPartOfPipeline
function, which was only consumed by a single package (taskrunmetrics).

As the only consumer, taskrunmetrics should own this interface, and
pull the taskrun meta data it needs on its own,
rather than depending on the package to maintain a compatible API
for its bespoke use case.

closes #5320

Changes

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • 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)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

The TaskRun API was maintaining a `isPartOfPipeline`
function, which was only consumed by a single package (taskrunmetrics).

As the only consumer, taskrunmetrics should own this interface, and
pull the taskrun meta data it needs on its own,
rather than depending on the package to maintain a compatible API
for its bespoke use case.
@tekton-robot tekton-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Aug 25, 2022
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 25, 2022
@xchapter7x
Copy link
Contributor Author

/assign @JeromeJu

@tekton-robot
Copy link
Collaborator

@xchapter7x: GitHub didn't allow me to assign the following users: JeromeJu.

Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @JeromeJu

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

@lbernick lbernick left a comment

Choose a reason for hiding this comment

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

thanks John! looks good, happy to approve once tests are moved over

pkg/taskrunmetrics/metrics.go Outdated Show resolved Hide resolved
@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 25, 2022
@lbernick
Copy link
Member

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Aug 25, 2022
@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/v1/taskrun_types.go 77.2% 76.9% -0.3
pkg/apis/pipeline/v1beta1/taskrun_types.go 77.2% 76.9% -0.3
pkg/taskrunmetrics/metrics.go 83.9% 84.4% 0.5

@JeromeJu
Copy link
Member

JeromeJu commented Aug 25, 2022

Thanks @xchapter7x for fixing this.
LGTM, just the docstring and the test cases to be restored in metrics.

@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/v1/taskrun_types.go 77.2% 76.9% -0.3
pkg/apis/pipeline/v1beta1/taskrun_types.go 77.2% 76.9% -0.3
pkg/taskrunmetrics/metrics.go 83.9% 84.4% 0.5

this adds the function to the exported API
and tests its behavior in isolation
@xchapter7x
Copy link
Contributor Author

/test pull-tekton-pipeline-go-coverage

@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/v1/taskrun_types.go 77.2% 76.9% -0.3
pkg/apis/pipeline/v1beta1/taskrun_types.go 77.2% 76.9% -0.3
pkg/taskrunmetrics/metrics.go 83.9% 84.4% 0.5

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lbernick

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 Aug 25, 2022
Copy link
Member

@jerop jerop left a comment

Choose a reason for hiding this comment

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

/lgtm

thanks @xchapter7x!

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2022
@bendory
Copy link
Contributor

bendory commented Aug 26, 2022

LGTM, and +1 for technical hygiene!

@tekton-robot tekton-robot merged commit 11e5c37 into tektoncd:main Aug 26, 2022
tekton-robot pushed a commit that referenced this pull request Aug 26, 2022
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor pipeline related function in taskrun_types.go
6 participants