1

My use case:

Job A is set to run Monday through Friday at 18:00.

Job B is dependent upon Job A succeeding but should only run Monday through Friday at 06:00. (Monday morning's run would depend upon Friday evening's run). I prefer set times rather than delays between jobs.

On any given morning, if I see that Job A failed (thus Job B never ran), I would like to be able to run (fix) Job A then immediately trigger Job B.

What I have found so far only offers part of this use case. I have tinkered with Pipeline and recently upgraded my Jenkins instance to 2.89.3, so I have access to the most recent features and plugins. Filesystem triggering seems doable.

Any suggestions are appreciated.

giromide
  • 51
  • 1
  • 4

2 Answers2

1

You can use the options available in "Build Triggers". Ex: Build Trigger

Hope this work for you!

beginnertopython
  • 101
  • 3
  • 10
0

This is a tricky Use Case as generally you want a job to immediately follow on from another one rather than waiting for potentially three days. Further complicated by wanting it to run straight away when you want it to.

I do not believe there is a "I have finished so kick this job at this time" downstream trigger So for the first part the only things I can think of are:

  • Job A kicks Job B as soon as it is finished and job B sits there with a time checker in it and starts its task when the time matches.
  • or Job A artefacts a file with its exit status and job B has a cron trigger for 6am mon-fri and picks up this artefact and then runs or doesn't dependent on the file contents

For the second part you could get the build Cause (see how to get $CAUSE in workflow for pipeline implementation and vote on https://issues.jenkins-ci.org/browse/JENKINS-41272 to get the feature when using sandbox). And then get your pipeline to behave differently depending on trigger

i.e. if you went for the second option above then In job B you could do if triggered by Cron then read the artefact and do as needed. If triggered by Upstream then just run regardless.

apr_1985
  • 1,764
  • 2
  • 14
  • 27