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 a --filename parameter to 'tkn tasks start'. #459

Merged
merged 1 commit into from
Nov 15, 2019
Merged

Conversation

dlorenc
Copy link
Contributor

@dlorenc dlorenc commented Nov 13, 2019

Changes

This parameter lets users specify a local task definition. tkn will then
inline that definition in the generated TaskRun, without creating it first.
This is useful for "as-code" scenarios and development.

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)
  • Includes docs (if user facing)
  • Regenerate the manpages and docs with make docs and make man if needed.
  • Run the code checkers with make check
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

tkn taskrun start now lets users specify a Task definition from a local file using the new --filename parameter

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 13, 2019
@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/task/start.go 93.2% 86.4% -6.8

@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/task/start.go 93.2% 86.4% -6.8

pkg/cmd/task/start.go Outdated Show resolved Hide resolved
pkg/cmd/task/start.go Outdated Show resolved Hide resolved

_ = c.MarkZshCompPositionalArgumentCustom(1, "__tkn_get_task")

return c
}

func startTask(opt startOptions, tname string) error {
// For stubbing in tests
Copy link
Member

Choose a reason for hiding this comment

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

This is actually used in startTask, so can we remove the comment?

pkg/cmd/task/start.go Outdated Show resolved Hide resolved
pkg/cmd/task/start.go Outdated Show resolved Hide resolved
defer func() {
parseTask = oldParseTask
}()
parseTask = func(p string) (*v1alpha1.Task, error) {
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't appear to cover parseTask in startTask.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see. It's because of the reassignment. Wondering if there's a better testing approach that can be done here, but I understand the reasoning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only other mechanism I can think of is to "inject" it through the startOptions struct into startTask.

Any thoughts on which you'd prefer?

Copy link
Member

Choose a reason for hiding this comment

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

I am comfortable keeping this as is for now, and we can iterate on it before next release. But we can also see if other folks have thoughts.

Copy link
Contributor Author

@dlorenc dlorenc 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 review!

@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/task/start.go 93.2% 86.4% -6.8

@danielhelfand
Copy link
Member

@dlorenc: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-tekton-cli-build-tests 3737a99 link /test pull-tekton-cli-build-tests
Full PR test history. Your PR dashboard.

Could you regenerate the manpages? This should resolve the CI issue.

This parameter lets users specify a local task definition. tkn will then
inline that definition in the generated TaskRun, without creating it first.
This is useful for "as-code" scenarios and development.
@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/task/start.go 93.2% 86.4% -6.8

@danielhelfand
Copy link
Member

/lgtm

Thanks, @dlorenc!

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 15, 2019
Copy link
Member

@chmouel chmouel left a comment

Choose a reason for hiding this comment

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

/lgtm


_ = c.MarkZshCompPositionalArgumentCustom(1, "__tkn_get_task")

return c
}

func startTask(opt startOptions, tname string) error {
// Setting as var for stubbing in tests
Copy link
Member

Choose a reason for hiding this comment

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

ah this is how you do monkey patching in GO :-D

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chmouel

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 Nov 15, 2019
@chmouel chmouel added this to the 0.6.0 🐨 milestone Nov 15, 2019
@tekton-robot tekton-robot merged commit d6f2e11 into master Nov 15, 2019
@danielhelfand danielhelfand deleted the start branch December 17, 2019 15:29
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.

5 participants