MultiJob retry functionality...I cant get it working

3,036 views
Skip to first unread message

Kris Massey

unread,
Oct 15, 2015, 9:44:09 AM10/15/15
to Jenkins Users
Hey All,

I'm new to the Jenkins MultiJOb plugin and I'm having some troubles using the retry functionality. 

I have a job configured

MultiJob
 - Phase 1
  - Job 1
  - Job 2
 - Phase 2
   - Job 3


Job 2 can have random failures (due to external client system), I've noticed that the MultiJob -> Phase -> Job configuration offers  a 'Enable retry' option, so I was hoping this would then attempt a retry and kick off phase 2 if the job passed the second time. 

My issue is the retry never seems to happen, below is some output on the console of the MultiJob

[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/jobs/build-process/workspace
    >> Job status: [Job2] the 'build only if scm changes' feature is disabled.
Starting build job p2.
    >> Job status: [Job1] the 'build only if scm changes' feature is disabled.
Starting build job p1.
Finished Build : #21 of Job : Job2 with status : FAILURE
Scanning failed job console output using parsing rule file .
Parser rules file not found.
Failed the build, the failure doesn't match the rules.
Finished Build : #23 of Job : Job1 with status : SUCCESS
Build step 'MultiJob Phase' marked build as failure
Notifying upstream projects of job completion
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
Finished: FAILURE

I've highlighted the lines I believe may be causing the issue, however I've got no idea how to solve it (hopefully its missing config as apposed to a bug in the MultiJob plugin)

Any help greatly appreciated! 

Zheng LiSheng

unread,
Jan 14, 2016, 5:25:17 AM1/14/16
to Jenkins Users
My problem is that nothing happens after selecting "Enable retry".

Aleksandar Kasabov

unread,
May 10, 2016, 6:14:33 AM5/10/16
to Jenkins Users
1) Make a parsing rule file, e.g. /var/lib/jenkins/rules/failures.txt with content 'Finished: FAILURE'
2) Register that in Jenkins general config, section "Multijob Retry Rules -> Parsing Rules"
3) Use that rule in the job that you want to be retried, the field is "Select strategy" which right below the "Enably retries" in the multiphase project settings

In general, move to the the pipeline plugin, Multijob plugin is quite old, not to mention the quality of the java source code it's writen in
Good luck

Fernando Miguélez

unread,
May 19, 2016, 12:04:48 PM5/19/16
to Jenkins Users

Great answer Aleksander. This feature should definetly be better documented.

In my case I found out that if if your task finishes with "UNSTABLE" instead of "FAILURE", phase retry configuration has no effect. 

Vitaly Karasik

unread,
Dec 14, 2016, 9:41:04 AM12/14/16
to Jenkins Users
Fernando, I see the same behavior - neither "UNSTABLE" not ".*" rules don't work for unstable build.
Even, according to the plugin code, it's just Java regex match, i.e. both should work.

Vitaly

ch...@apptimize.com

unread,
Dec 20, 2016, 8:07:04 PM12/20/16
to Jenkins Users
Hi all,

Thanks for the help!  Just to clarify, the instructions are:

In Manage Jenkins > Configure System:
  1. Somewhere on the server running Jenkins, store a text file with the content from the Jenkins output to parse, for example "Finished: FAILURE"
  2. Under "Multijob Retry Rules"
    1. "Name" is anything you want to name it, you use it in the strategy dropdown below
    2. "Parsing Rules File" is the path to the text file

Then on the job itself, under Build > MultiJob Phase > Advanced...:
  1. Check "Enable retry"
  2. Select strategy from the dropdown

Thanks!
Chris

Vitaly Karasik

unread,
Dec 21, 2016, 3:32:28 AM12/21/16
to Jenkins Users
You're right.
The only catch is that there is no description/examples how to write rules.
For instance, how to restart not only failed, but unstable jobs as well.
At the end I just modify "unstable" status to "failure" in order to use rule for retry.

ch...@apptimize.com

unread,
Dec 21, 2016, 8:22:56 PM12/21/16
to Jenkins Users
Thank you, I got it working for failures as well.

Anu S

unread,
Oct 21, 2020, 1:37:28 PM10/21/20
to Jenkins Users
Has anyone tried this option enable retry using jobdsl ?
enable retry itself missing under multijob - steps - phase ...


Then on the job itself, under Build > MultiJob Phase > Advanced...:
  1. Check "Enable retry"
  2. Select strategy from the dropdown

Reply all
Reply to author
Forward
0 new messages