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 create command for task and clustertask #1359

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

vinamra28
Copy link
Member

@vinamra28 vinamra28 commented Apr 21, 2021

Changes

Since Task and ClusterTask shares the same spec, there can be a
usecase where user want to convert the Task to ClusterTask which they
have built so that it can be used ClusterWide.

In this PR:-

  • Add an create subcommand for task which can be executed as:-
    tkn task create tname --from-clustertask=clustertaskname
  • The above command will create a new Task from the existing ClusterTask
    if exists
  • Add an create subcommand for clustertask which can be executed as:-
    tkn clustertask create ctname --from-task tname -n ns
  • The above command will create a new ClusterTask from the Task defined in namespace keeping.
  • Also allowing backward compatibility to support v1alpha1.

closes #642

Signed-off-by: vinamra28 [email protected]

Submitter Checklist

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

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

Add create subcommand for ClusterTask and Task which will help to convert the Task to ClusterTask and vice-versa.

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Apr 21, 2021
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 21, 2021
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 62.5% -6.9
pkg/cmd/task/export.go Do not exist 85.7%

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from c904c0b to 938efe6 Compare April 22, 2021 02:43
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/task/export.go Do not exist 85.7%

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from 938efe6 to a524ba7 Compare April 22, 2021 03:03
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/task/export.go Do not exist 86.7%

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from a524ba7 to 1c9d73b Compare April 22, 2021 04:56
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 22, 2021
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/clustertask/export.go Do not exist 86.7%
pkg/cmd/task/export.go Do not exist 86.7%
pkg/task/task.go 43.6% 63.4% 19.8

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from 1c9d73b to 47d045b Compare April 22, 2021 05:02
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/clustertask/export.go Do not exist 86.7%
pkg/cmd/task/export.go Do not exist 86.7%
pkg/task/task.go 43.6% 63.4% 19.8

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from 47d045b to 502326c Compare April 22, 2021 05:33
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 22, 2021
@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from 502326c to 765fb26 Compare April 22, 2021 05:35
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/clustertask/export.go Do not exist 85.7%
pkg/cmd/task/export.go Do not exist 86.7%
pkg/task/task.go 43.6% 63.4% 19.8

@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/clustertask/export.go Do not exist 85.4%
pkg/cmd/task/export.go Do not exist 86.7%
pkg/task/task.go 43.6% 63.4% 19.8

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from 765fb26 to 73e1c65 Compare April 22, 2021 06:24
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/clustertask/export.go Do not exist 87.8%
pkg/cmd/task/export.go Do not exist 86.7%
pkg/task/task.go 43.6% 63.4% 19.8

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from 73e1c65 to 79223e5 Compare April 22, 2021 06:40
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/clustertask/export.go Do not exist 87.8%
pkg/cmd/task/export.go Do not exist 87.8%
pkg/task/task.go 43.6% 63.4% 19.8

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from 79223e5 to e76d7fc Compare April 22, 2021 06:50
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/clustertask/export.go Do not exist 87.8%
pkg/cmd/task/export.go Do not exist 87.8%
pkg/task/task.go 43.6% 63.4% 19.8

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from e76d7fc to 892bab7 Compare April 22, 2021 06:55
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 72.2% 2.8
pkg/cmd/clustertask/export.go Do not exist 87.8%
pkg/cmd/task/export.go Do not exist 87.8%
pkg/task/task.go 43.6% 63.4% 19.8

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 28, 2021
@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from 028242f to 8372057 Compare October 1, 2021 06:15
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 1, 2021
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 70.3% 0.9
pkg/cmd/clustertask/create.go Do not exist 90.9%
pkg/cmd/task/create.go Do not exist 90.3%
pkg/task/task.go 43.6% 48.4% 4.8

@vinamra28 vinamra28 force-pushed the clustertask-to-task branch 3 times, most recently from fc19e63 to 0b1ee96 Compare October 1, 2021 06:25
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 70.3% 0.9
pkg/cmd/clustertask/create.go Do not exist 90.9%
pkg/cmd/task/create.go Do not exist 90.9%
pkg/task/task.go 43.6% 48.4% 4.8

@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 70.3% 0.9
pkg/cmd/clustertask/create.go Do not exist 90.9%
pkg/cmd/task/create.go Do not exist 90.9%
pkg/task/task.go 43.6% 48.4% 4.8

@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 70.3% 0.9
pkg/cmd/clustertask/create.go Do not exist 90.9%
pkg/cmd/task/create.go Do not exist 90.9%
pkg/task/task.go 43.6% 48.4% 4.8

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: piyush-garg, 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:
  • OWNERS [piyush-garg,vdemeester]

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

- This commit adds a create function which can create a `ClusterTask`
and it's corresponding tests.
- Add a subcommand for `ClusterTask` which can create a `ClusterTask`
from a `Task` with the help of command `tkn clustertask create
--from=taskname`.

Signed-off-by: vinamra28 <[email protected]>
- This commit add a create function which can create a `Task` and add
it's corresponding tests.
- Add a subcommand for `Task` which can create a `Task` from a
`ClusterTask` with the help of command `tkn task create
--from=clustertaskname`.

Signed-off-by: vinamra28 <[email protected]>
@vinamra28 vinamra28 force-pushed the clustertask-to-task branch from 0b1ee96 to 4956625 Compare October 4, 2021 09:32
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/clustertask/clustertask.go 69.4% 70.3% 0.9
pkg/cmd/clustertask/create.go Do not exist 90.9%
pkg/cmd/task/create.go Do not exist 90.9%
pkg/task/task.go 43.6% 48.4% 4.8

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 Oct 4, 2021
@tekton-robot tekton-robot merged commit 6d71e1c into tektoncd:main Oct 4, 2021
@vinamra28 vinamra28 deleted the clustertask-to-task branch October 4, 2021 10:58
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. 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.

Convert clustertask to task and vice versa
6 participants