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

Add functionality to list clustertasks #161

Merged
merged 3 commits into from
Jul 16, 2019

Conversation

onyiny-ang
Copy link
Contributor

Changes

Addresses #118: Adding functionality to list ClusterTasks

Submitter Checklist

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

See the contribution guide
for more details.

Release Notes

Added support for listing clustertasks with `tkn clustertask list`

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 11, 2019
@vdemeester
Copy link
Member

/ok-to-test

@tekton-robot tekton-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 12, 2019
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

@onyiny-ang Looking good 👼 👍

@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/clustertask.go Do not exist 100.0%
pkg/cmd/clustertask/list.go Do not exist 67.4%

@hrishin
Copy link
Member

hrishin commented Jul 12, 2019

/test pull-tekton-cli-build-tests

- Lists NAME and AGE of clustertasks
- Follows existing tkn command structure
- Closes tektoncd#118

Just adjust the vendor modules
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/clustertask.go Do not exist 100.0%
pkg/cmd/clustertask/list.go Do not exist 67.4%

func Command(p cli.Params) *cobra.Command {
cmd := &cobra.Command{
Use: "clustertask",
Aliases: []string{"c", "clustertasks"},
Copy link
Member

Choose a reason for hiding this comment

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

How about ct instead of c

}

clustertasks, err := listAllClustertasks(cs.Tekton)

Copy link
Member

Choose a reason for hiding this comment

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

nit: may want to remove the blank line

return nil, err
}

if len(clustertasks.Items) == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

isn't this if superfluous? i.e. wouldn't the output be the same if we deleted it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed from this and task list.go in follow up commit

Copy link
Member

@sthaha sthaha left a comment

Choose a reason for hiding this comment

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

Thanks for the patch ❤️

looks good overall but minor comments to address

Use: "list",
Aliases: []string{"ls"},
Short: "Lists clustertasks in a namespace",
Long: ``,
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to add the Long field if it's empty 😝 (we may need to fix that on other commands)

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 also deleted the "Long" flag from pipelines and task list.go `

- Removes "Long" command flags that are left blank
- Removes superflous "if" statement
@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/clustertask/clustertask.go Do not exist 100.0%
pkg/cmd/clustertask/list.go Do not exist 65.9%
pkg/cmd/task/list.go 67.4% 65.9% -1.5

Copy link
Member

@vdemeester vdemeester 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 tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 16, 2019
@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: onyiny-ang, 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 Jul 16, 2019
@tekton-robot tekton-robot merged commit e0dea38 into tektoncd:master Jul 16, 2019
return clustertasks, nil
}

func listClustertaskDetails(cs versioned.Interface) (*v1alpha1.ClusterTaskList, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please help me understand why we need this func ? isn't this the same as listAllClusterTasks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in #165

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. cla: yes lgtm Indicates that a PR is ready to be merged. 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.

6 participants