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 --dry-run Option for tkn task start #662

Merged
merged 1 commit into from
Feb 3, 2020
Merged

Add --dry-run Option for tkn task start #662

merged 1 commit into from
Feb 3, 2020

Conversation

danielhelfand
Copy link
Member

Closes #654

Similar to #643, this pull request adds the ability to do a dry run of a taskrun with tkn task start. A notable issue with this, is that steps won't be included with this approach since it mainly relies on a TaskRef to start tasks, but it does show information on inputs, outputs, and params as well as the task reference being used. Using the -f option does provide information about steps since it does not require a TaskRef.

This pull request also makes a small change for the --timeout option, which is currently not available with -f due to only defining it when a task name argument is provided.

The last change in this pr is getting rid of the -o shorthand for output with --dry-run for tkn pipeline start --dry-run. -o is not available with tkn task start because of outputs so I think it makes sense to keep it consistent across all commands. Only specifying --output works now.

Submitter Checklist

  • 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

Release Notes

Add --dry-run option for tkn task start

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 30, 2020
@@ -186,6 +194,7 @@ func startTask(opt startOptions, args []string) error {
TaskSpec: &task.Spec,
}
}
tr.Spec.Timeout = &metav1.Duration{Duration: timeoutSeconds}
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving setting Timeout here so that -f can set timeout for TaskRun.

@@ -153,7 +153,7 @@ like cat,foo,bar
c.Flags().BoolVarP(&opt.Last, "last", "L", false, "re-run the pipeline using last pipelinerun values")
c.Flags().StringSliceVarP(&opt.Labels, "labels", "l", []string{}, "pass labels as label=value.")
c.Flags().BoolVarP(&opt.DryRun, "dry-run", "", false, "preview pipelinerun without running it")
c.Flags().StringVarP(&opt.Output, "output", "o", "", "format of pipelinerun dry-run (yaml or json)")
c.Flags().StringVarP(&opt.Output, "output", "", "", "format of pipelinerun dry-run (yaml or json)")
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing to keep consistency across --dry-run commands.

@@ -898,3 +900,130 @@ func Test_parseRes(t *testing.T) {
})
}
}

func TestTaskStart_ExecuteCommand(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

We should eventually move as many tests in this block as can be moved.

@piyush-garg
Copy link
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 3, 2020
Copy link
Contributor

@pradeepitm12 pradeepitm12 left a comment

Choose a reason for hiding this comment

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

/lgtm

@chmouel
Copy link
Member

chmouel commented Feb 3, 2020

/lgtm
/approve

Thanks 👍🏼🔥

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chmouel, pradeepitm12

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 Feb 3, 2020
@tekton-robot tekton-robot merged commit 73e759a into tektoncd:master Feb 3, 2020
@danielhelfand danielhelfand deleted the task_dry_run branch February 10, 2020 16:21
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.

Add --dry-run Option for tkn task start
6 participants