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

feat: tkn-results add pipelinerun list and result describe command #908

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xinnjie
Copy link
Contributor

@xinnjie xinnjie commented Dec 13, 2024

Changes

tkn-results introduces commands for listing pipelineruns and describing results, improving user experience and assisting contributors in comprehending the Results API. Ideally, the tkn-results experience should mirror that of tkn(mybe in far future).

To list PipelineRuns in the default namespace, use: tkn-results pipelinerun list

For details on a specific result, run: tkn-results result describe <result-name> or tkn-results result describe -n <namespace> --uid <result-uid>

Currently, PipelineRuns listing does not utilize paging.

Related to #587, More commands like tkn results taskrun list/describe/logs are expected to be added in an upcoming PR(Try best I can).

Breaking Changes

tkn-results list is moved to tkn-results result list for clarity.

Examples

records get:

(base) ➜  results git:(feat-tkn-results-cli-ux) ✗ bin/tkn-results records get default/results/6dbeca0d-7029-4b7e-a535-e3c9259923e2/records/fcf2c228-9808-32a8-8c7e-8d9ec536ad3e
Name:              default/results/6dbeca0d-7029-4b7e-a535-e3c9259923e2/records/fcf2c228-9808-32a8-8c7e-8d9ec536ad3e
UID:               1680bf31-c78d-4168-bd0b-051c64e3225c
Status:
Created:   4 days ago   Duration:   6.798992s
Type:         results.tekton.dev/v1alpha3.Log
Data:
{
         "kind": "Log",
         "spec": {
           "type": "File",
           "resource": {
             "uid": "6dbeca0d-7029-4b7e-a535-e3c9259923e2",
             "kind": "TaskRun",
             "name": "hello-task-runctshh",
             "namespace": "default"
           }
         },
         "status": {
           "path": "default/fcf2c228-9808-32a8-8c7e-8d9ec536ad3e/hello-task-runctshh-log",
           "size": 268,
           "isStored": true,
           "isRetryableErr": false,
           "errorOnStoreMsg": ""
         },
         "metadata": {
           "uid": "fcf2c228-9808-32a8-8c7e-8d9ec536ad3e",
           "name": "hello-task-runctshh-log",
           "namespace": "default",
           "creationTimestamp": null
         },
         "apiVersion": "results.tekton.dev/v1alpha3"
       }

pipelinerun list:

(base) ➜  results git:(feat-tkn-results-cli-ux) ✗ bin/tkn-results pipelinerun list
NAMESPACE   UID                       STARTED      DURATION   STATUS
default     hello-goodbye-run-vfsxn   4 days ago   1m10s      Succeeded
default     hello-goodbye-run-xtw2j   4 days ago   0s         Failed(CouldntGetTask)

And result describe below.

Known issues:

(base) ➜  results git:(feat-tkn-results-cli-ux) ✗ bin/tkn-results result describe default/results/e6b4b2e3-d876-4bbe-a927-95c691b6fdc7       
Name:   default/results/e6b4b2e3-d876-4bbe-a927-95c691b6fdc7
UID:    949eebd9-1cf7-478f-a547-9ee313035f10
Annotations:
        object.metadata.name=hello-goodbye-run-vfsxn
        tekton.dev/pipeline=hello-goodbye
Status:
        Created:   23 hours ago   DURATION: 1m9.582481s
Summary:
        Type:   tekton.dev/v1.PipelineRun
        Status:
        STARTED   DURATION   STATUS
         ---       ---        SUCCESS

STARTED and DURATION are not displayed due to the absence of start/end times in the result summary.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add 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 contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

`tkn-results` introduces commands for listing and describing pipeline runs and results. The command `tkn-results list -` is now `tkn-results result list`.

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Dec 13, 2024
@tekton-robot
Copy link

Hi @xinnjie. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@tekton-robot tekton-robot requested a review from enarha December 13, 2024 11:00
@tekton-robot tekton-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 13, 2024
@tekton-robot tekton-robot requested a review from khrm December 13, 2024 11:00
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 13, 2024
@xinnjie
Copy link
Contributor Author

xinnjie commented Dec 13, 2024

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 13, 2024
@xinnjie xinnjie force-pushed the feat-tkn-results-cli-ux branch 2 times, most recently from 63ade1e to ba0455b Compare December 13, 2024 12:34
@@ -21,11 +21,12 @@
package pagetoken_go_proto

import (
reflect "reflect"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't want to modify this file, but make goimports keeps fixing this importing.

@xinnjie
Copy link
Contributor Author

xinnjie commented Dec 16, 2024

Is this type of improvement welcome?

Personally I just wanted to know about Results API, and make the progress smoother using tkn-results.

@khrm

@khrm
Copy link
Contributor

khrm commented Dec 17, 2024

Yes, this kind of contribution is welcome. Thanks for the contribution.

@xinnjie xinnjie force-pushed the feat-tkn-results-cli-ux branch from 3cccaa0 to 7277c4f Compare December 17, 2024 08:37
Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 18, 2024
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/cli/cmd/pipelinerun/list.go Do not exist 68.4%
pkg/cli/cmd/pipelinerun/pipelinerun.go Do not exist 100.0%
pkg/cli/cmd/records/get.go Do not exist 0.0%
pkg/cli/cmd/result/describe.go Do not exist 64.3%
pkg/cli/cmd/result/list.go Do not exist 40.0%
pkg/cli/cmd/result/result.go Do not exist 100.0%
pkg/cli/flags/flags.go Do not exist 0.0%
pkg/cli/flags/flags.go Do not exist 80.0%
pkg/cli/flags/flags.go Do not exist 0.0%
pkg/cli/format/format.go 79.2% 23.9% -55.3
pkg/cli/format/format.go Do not exist 0.0%
pkg/cli/format/format.go Do not exist 41.3%
pkg/test/cobra.go Do not exist 100.0%
pkg/test/cobra.go Do not exist 100.0%
pkg/test/cobra.go Do not exist 0.0%
pkg/test/expect.go Do not exist 80.0%
pkg/test/expect.go Do not exist 80.0%
pkg/test/expect.go Do not exist 0.0%
pkg/test/fake/results.go Do not exist 27.6%
pkg/test/fake/results.go Do not exist 15.5%

@khrm
Copy link
Contributor

khrm commented Dec 18, 2024

Please rebase the PR.

pr := &pipelinev1.PipelineRun{}
switch record.Data.GetType() {
case "tekton.dev/v1beta1.PipelineRun":
prV1beta1 := &pipelinev1beta1.PipelineRun{}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can add //nolint:staticcheck adjacent to this line. It will fix the build test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed and rebased.

@xinnjie xinnjie force-pushed the feat-tkn-results-cli-ux branch from 140ca2b to 20132e6 Compare December 19, 2024 04:34
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/cli/cmd/pipelinerun/list.go Do not exist 69.4%
pkg/cli/cmd/pipelinerun/pipelinerun.go Do not exist 100.0%
pkg/cli/cmd/records/get.go Do not exist 0.0%
pkg/cli/cmd/result/describe.go Do not exist 64.3%
pkg/cli/cmd/result/list.go Do not exist 40.0%
pkg/cli/cmd/result/result.go Do not exist 100.0%
pkg/cli/flags/flags.go 0.0% 80.0% 80.0
pkg/cli/flags/flags.go Do not exist 0.0%
pkg/cli/flags/flags.go Do not exist 0.0%
pkg/cli/flags/flags.go Do not exist 0.0%
pkg/cli/format/format.go 79.2% 23.9% -55.3
pkg/cli/format/format.go Do not exist 41.3%
pkg/cli/format/format.go Do not exist 0.0%
pkg/test/cobra.go Do not exist 100.0%
pkg/test/cobra.go Do not exist 100.0%
pkg/test/cobra.go Do not exist 0.0%
pkg/test/expect.go Do not exist 80.0%
pkg/test/expect.go Do not exist 80.0%
pkg/test/expect.go Do not exist 0.0%
pkg/test/fake/results.go Do not exist 27.6%
pkg/test/fake/results.go Do not exist 31.0%
pkg/test/fake/results.go Do not exist 0.0%

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

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 Dec 20, 2024
@xinnjie
Copy link
Contributor Author

xinnjie commented Dec 23, 2024

@khrm @enarha Please review at your convenience.

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

4 participants