Answers: <p>The simplest way to do this would probably be to add a <code>retry</code> option to the pipeline.</p>
  <p>See <a href="https://www.jenkins.io/doc/book/pipeline/syntax/#options" rel="nofollow noreferrer">https://www.jenkins.io/doc/book/pipeline/syntax/#options</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2021-09-12T13:26:52.327Z
Answers: As @Bruce Becker mentioned, you can use `retry` steps in your jenkinsfile. optionally you can set how many time the stage tries attempting or set `timeout` See, https://www.jenkins.io/doc/pipeline/tour/running-multiple-steps/#timeouts-retries-and-more
Answers: Chachatonel Hashimotto
Answers: CC BY-SA 4.0
Answers: 2021-09-12T11:52:33.583Z
Answers: 2021-09-12T11:52:33.583Z
Answers: Bruce Becker
Body: <p>I've heard about the Naginator plugin, but unfortunately it's only for freestyle job type.</p>
  <p>Is there any solution for pipeline jobs to be triggered if they failed? I thought about creating a command in the syntax or maybe triggering a freestyle job on the pipeline.</p>
  
Comments: CC BY-SA 4.0
Comments: 2021-09-13T15:11:49.380Z
Comments: Does this answer your question? [How to retrigger a Jenkins build after failure using declarative syntax?](https://devops.stackexchange.com/questions/5173/how-to-retrigger-a-jenkins-build-after-failure-using-declarative-syntax)
Comments: jayhendren
Tags: <jenkins><jenkins-pipeline><jenkins-plugins>
Title: Re-running a pipeline job if failed
UserDisplayName: Lev Meshorer
ThreadText: # Re-running a pipeline job if failed
  
  (Asked by: username_0 on 2021-09-12)
  
  I've heard about the Naginator plugin, but unfortunately it's only for freestyle job type.
  
  Is there any solution for pipeline jobs to be triggered if they failed? I thought about creating a command in the syntax or maybe triggering a freestyle job on the pipeline.
  
  **Tags:** jenkins, jenkins-pipeline, jenkins-plugins
  
  > **Comments:**
  > **username_1**: Does this answer your question? [How to retrigger a Jenkins build after failure using declarative syntax?](https://devops.stackexchange.com/questions/5173/how-to-retrigger-a-jenkins-build-after-failure-using-declarative-syntax)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-09-12. Score: 1
  
  The simplest way to do this would probably be to add a `retry` option to the pipeline.
  
  See <https://www.jenkins.io/doc/book/pipeline/syntax/#options>
  
  > **Comments:**
  > **username_3**: As @username_2 mentioned, you can use `retry` steps in your jenkinsfile. optionally you can set how many time the stage tries attempting or set `timeout` See, https://www.jenkins.io/doc/pipeline/tour/running-multiple-steps/#timeouts-retries-and-more  
  
  ---
  
  