Restart from stage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Restart from stage

unlimhost
Are there any examples of the implementation of running a pipeline from a particular stage? I need to set in the pipeline parameters to make it run on a specific node and from a specific stage. If there are no questions with the first one, what are the easiest options to pass <stage name> from which to run the pipelines, skipping the previous ones?
Something similar I found here but it's not enough for me to implement this task:
https://github.com/SAP/jenkins-library/blob/master/vars/pipelineRestartSteps.groovy

https://issues.jenkins.io/browse/JENKINS-52391

Thanks!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1043191357.20210323014723%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Restart from stage

Gianluca
Hi what-ever-is-your-name-:-)

I use the "when" block to run only specific stages depending on the
parameters: https://www.jenkins.io/doc/book/pipeline/syntax/#when

I hope that fits your case too.

Cheers,

Gianluca.

On 22/03/2021 22:47, [hidden email] wrote:
> Are there any examples of the implementation of running a pipeline from a particular stage? I need to set in the pipeline parameters to make it run on a specific node and from a specific stage. If there are no questions with the first one, what are the easiest options to pass <stage name> from which to run the pipelines, skipping the previous ones?
> Something similar I found here but it's not enough for me to implement this task:
> https://github.com/SAP/jenkins-library/blob/master/vars/pipelineRestartSteps.groovy
>
> https://issues.jenkins.io/browse/JENKINS-52391
>
> Thanks!
>

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4d48f1ee-e607-f5a8-9f85-57196d5ae5f4%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Restart from stage

unlimhost
Thanks, Gianluca.

Your professional help, as always, is very operational and useful!
Thanks to you, I have implemented the ability to run from any Stage, but I would also like to form in "Active Choices Reactive Parameter" plugin automatic list from the names of Stages {}, which I have in PiPleine. Are there ready examples of code to obtain a list of names of all Stages from code pipeline (to select the stage I need before building the pipeline) ?


> Hi what-ever-is-your-name-:-)

> I use the "when" block to run only specific stages depending on the parameters: https://www.jenkins.io/doc/book/pipeline/syntax/#when

> I hope that fits your case too.

> Cheers,

> Gianluca.

> On 22/03/2021 22:47, [hidden email] wrote:
>> Are there any examples of the implementation of running a pipeline from a particular stage? I need to set in the pipeline parameters to make it run on a specific node and from a specific stage. If there are no questions with the first one, what are the easiest options to pass <stage name> from which to run the pipelines, skipping the previous ones?
>> Something similar I found here but it's not enough for me to implement this task:
>> https://github.com/SAP/jenkins-library/blob/master/vars/pipelineRestartSteps.groovy
>>
>> https://issues.jenkins.io/browse/JENKINS-52391
>>
>> Thanks!
>>

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/232458043.20210323032212%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Restart from stage

Gianluca
Hi,

I use the following code to walk through all stages of the pipeline for
a different reason but it could be an hint for you to achieve your goal:

WorkflowRun run = prevBuild.getRawBuild()
NodeGraphBuilder graphBuilder =
NodeGraphBuilder.NodeGraphBuilderFactory.getInstance(run);
  def flowNodes = graphBuilder.getPipelineNodes()

  for (Iterator iterator = flowNodes.iterator(); iterator.hasNext();) {
         def node = iterator.next()
         if (node.getDisplayName() == stageName) {
             return node.getStatus().getResult() == BlueRunResult.SUCCESS
         }
  }

A stage is a pipeline node, but there are nodes that are not stages. So,
you probably need to dig into internal code to find out how to identify
only the stages.

Cheers,

Gianluca.


On 23/03/2021 00:22, [hidden email] wrote:

> Thanks, Gianluca.
>
> Your professional help, as always, is very operational and useful!
> Thanks to you, I have implemented the ability to run from any Stage, but I would also like to form in "Active Choices Reactive Parameter" plugin automatic list from the names of Stages {}, which I have in PiPleine. Are there ready examples of code to obtain a list of names of all Stages from code pipeline (to select the stage I need before building the pipeline) ?
>
>
>> Hi what-ever-is-your-name-:-)
>> I use the "when" block to run only specific stages depending on the parameters: https://www.jenkins.io/doc/book/pipeline/syntax/#when
>> I hope that fits your case too.
>> Cheers,
>> Gianluca.
>> On 22/03/2021 22:47, [hidden email] wrote:
>>> Are there any examples of the implementation of running a pipeline from a particular stage? I need to set in the pipeline parameters to make it run on a specific node and from a specific stage. If there are no questions with the first one, what are the easiest options to pass <stage name> from which to run the pipelines, skipping the previous ones?
>>> Something similar I found here but it's not enough for me to implement this task:
>>> https://github.com/SAP/jenkins-library/blob/master/vars/pipelineRestartSteps.groovy
>>>
>>> https://issues.jenkins.io/browse/JENKINS-52391
>>>
>>> Thanks!
>>>

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1834c4d1-50d7-1b0d-ffcb-abb53753ab83%40gmail.com.