cli icon indicating copy to clipboard operation
cli copied to clipboard

Add `tkn` cli support to rerun an existing resolver based pipelinerun

Open anithapriyanatarajan opened this issue 1 year ago • 4 comments

Feature request

CLI option to rerun a resolver based pipelinerun

Use case

As a CLI user I want to be able to rerun a resolver based pipelinerun simply by referencing an existing pipelineRun name

UI Example

$ tkn pipelinerun rerun <pipelinerun-name>

anithapriyanatarajan avatar Nov 06 '24 09:11 anithapriyanatarajan

/area roadmap

rupalibehera avatar Mar 10 '25 14:03 rupalibehera

/assign

pratap0007 avatar May 28 '25 14:05 pratap0007

Hi @anithapriyanatarajan , Should the tkn pipelinerun rerun command serve as a general-purpose command for rerunning any PipelineRun, or should it be only supporting rerunning resolver-based PipelineRuns?

pratap0007 avatar Jun 23 '25 08:06 pratap0007

@pratap0007 - Thank you. As you have mentioned it would be correct for the command to enable the rerun of any PipelineRun, not just those that were resolver-based.

anithapriyanatarajan avatar Jun 23 '25 14:06 anithapriyanatarajan

Hi @anithapriyanatarajan, Currently tkn cli, support two command to rerun the pipelinerun from a pipeline under tkn p start command

  • tkn p start --last <pipeline_name> this command re-run the Pipeline using last PipelineRun values
  • tkn p start <pipeline_name> --usepipelinerun <pipelinerun_name> rerun the pipeline by using --usepipelinerun values to re-run the pipeline.

so, should we implement command tkn pipelinerun rerun to rerun the pipelinerun as it looks like similar use case have in the existing command? cc: @tektoncd/cli-collaborators

pratap0007 avatar Jul 02 '25 06:07 pratap0007

what do you mean by "enable the rerun of any PipelineRun, not just those that were resolver-based." in which context?

chmouel avatar Jul 03 '25 09:07 chmouel

@pratap0007 @chmouel - I am sorry to have confused this a bit.

It was created explicitly to sort out the missing rerun behavior for resolver based pipeline runs.

$tkn pipeline start <pipeline-name> -n demo-1 --use-pipelinerun <existing-pr-name> . Here the cli always expects a pipeline name that exists in the cluster. With resolver the logic has to be enhanced to retrieve the pipelinedef from the existing resolution request or using the resolver params of the PipelineRun

I shall share the internal slack thread in this regards.

So, this issue was explicitly for ensuring ability to rerun a resolverbased PR from CLI

anithapriyanatarajan avatar Jul 03 '25 11:07 anithapriyanatarajan

there is no pipeline restart, there is only pipelinerun, for cli i made tkn pr export for that usecase, ie:

% tkn pr export -n scratch-my-back fifth-pr-from-pac-ssh2w|k create -f-

maybe we can the ui better but i think we can just document it better

chmouel avatar Jul 03 '25 11:07 chmouel

I explored the tkn pr export command and found that it is primarily used for exporting a PipelineRun from one namespace to another. For example, as we can use tkn pr export -n scratch-my-back fifth-pr-from-pac-ssh2w | kubectl create -f - to recreate a PipelineRun in a different namespace.

However, this approach doesn't not look ideal for rerunning a PipelineRun within the same namespace. tkn pipelinerun rerun <pipelinerun-name> command is much more user-friendly and straightforward for rerunning a pipeline. WDYT: @chmouel @anithapriyanatarajan @tektoncd/cli-maintainers

pratap0007 avatar Jul 17 '25 13:07 pratap0007

@pratap0007 if we add a generate name we can do a rename,

we can just leverage on this for the rerun command, that's what i meant by better UI

chmouel avatar Jul 23 '25 13:07 chmouel

@pratap0007 if we add a generate name we can do a rename,

we can just leverage on this for the rerun command, that's what i meant by better UI

Hi @chmouel, I didn't fully understand. Are you suggesting to rename the PipelineRun using generateName, and then use the tkn export command to re-run it?

pratap0007 avatar Jul 24 '25 11:07 pratap0007

@pratap0007 - There was another suggestion for user experience as alternate to specifying pipelinerun name in today's working group call to incorporate a --flag to indicate that the pipeline is remote. Something like - tkn p start --last <pipeline_name> --resolvertype=remote

anithapriyanatarajan avatar Aug 13 '25 18:08 anithapriyanatarajan