You can use an Exclusion plugin.
- Setup the same "resource" string for both jobs (read the plugin page for details)
- The
p1
job should be on a nightly schedule to start earlier thanp2
job - The
p1
job should be on a Tuesday-only schedule to start slightly later thanp1
This way, on Tuesdays, when p2
runs, the "resource" will already be in-use by p1
. I haven't actually used this plugin, so not sure if it will cause p2
to wait or fail, but if the later is true, you can configure p2
to retry failed builds with something like this plugin
Alternatively, the Conditional Build Step plugin can be used.
- In
p1
configure a Conditional Build Step after the building step (so if the building step fails, it never executes. - It uses Run Condition plugin, which will allow to select Day of Week as a condition. Select Tuesday
- Then use Parameterized Trigger Plugin to add Trigger/call builds on other projects build step that will trigger
p2