Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-44264

How to block current job until postbuild triggered job is completed

      looking for a way to block the main job until the post build job is completed.

      just like there is an option for pre-build job "Block until the triggered projects finish their builds"

      is there any for PostBuild trigger job?

       

          [JENKINS-44264] How to block current job until postbuild triggered job is completed

          Tim Brown added a comment -

          I haven't done any junkies work in a while, but I think it should be possible.

          Just to clarify, what is it your upstream build is doing that is dependent on the downstream build finishing ?

          Tim Brown added a comment - I haven't done any junkies work in a while, but I think it should be possible. Just to clarify, what is it your upstream build is doing that is dependent on the downstream build finishing ?

          pooja shah added a comment - - edited

          yes & no, so my use-case is slight different Tim

          it goes like this

          • job 1 (sets appropriate env and does some tests) is triggered by an external call
          • job 2(which runs another tests) is in post-build now since its finish is not mandatory to finish job 1 so job 1 gets build again even if thhe job 2's build is finished 

          so in this case when there is frequent traffic which keeps building job 1, job 2 may screw up(false results) as job 2's tests are dependent on the environment set by job 1.

          So it becomes necessary for me, until job 2 is done, don't let job 1 end.

           

          I'm planning to look into join trigger plugin  in case it can help in this by default

           

          pooja shah added a comment - - edited yes & no, so my use-case is slight different Tim it goes like this job 1 (sets appropriate env and does some tests) is triggered by an external call job 2(which runs another tests) is in post-build now since its finish is not mandatory to finish job 1 so job 1 gets build again even if thhe job 2's build is finished  so in this case when there is frequent traffic which keeps building job 1, job 2 may screw up(false results) as job 2's tests are dependent on the environment set by job 1. So it becomes necessary for me, until job 2 is done, don't let job 1 end.   I'm planning to look into join trigger plugin   in case it can help in this by default  

          Tim Brown added a comment - - edited

          Sorry, I haven't used junkies in a while as we moved to something else, but would it be possible add a blocking, parameterized, pre-build trigger to job 2 so it starts start job 1 before it, and then set the external call to trigger job 2?

           

          Tim Brown added a comment - - edited Sorry, I haven't used junkies in a while as we moved to something else, but would it be possible add a blocking, parameterized, pre-build trigger to job 2 so it starts start job 1 before it, and then set the external call to trigger job 2?  

          pooja shah added a comment -

          yes Tim, thanks for the time. Good idea, had thought of it but its not useful in my current case because I need to modify the current implementation completely because of these 2 jobs ( Eg. I have job 3, 4, 5 etc. which don't have any associated post build job and so the External call's behavior has to be modified a lot)

          and I understand implementing "downstream can block upstream job" is tricky because then upstream job to be kept in queue to wait until last build's downstream job's build is finished

          Eg. > upstream has to know the build number of downstream's triggered build to update the state back that its done to notify Queue manager to process the new build of upstream   (+ keep polling if its done)

          for very reason I believe, Join Trigger also doesn't help.

           

          pooja shah added a comment - yes Tim, thanks for the time. Good idea, had thought of it but its not useful in my current case because I need to modify the current implementation completely because of these 2 jobs ( Eg. I have job 3, 4, 5 etc. which don't have any associated post build job and so the External call's behavior has to be modified a lot) and I understand implementing "downstream can block upstream job" is tricky because then upstream job to be kept in queue to wait until last build's downstream job's build is finished Eg. > upstream has to know the build number of downstream's triggered build to update the state back that its done to notify Queue manager to process the new build of upstream   (+ keep polling if its done) for very reason I believe, Join Trigger also doesn't help.  

          pooja shah added a comment -

          though for now I have worked around by moving job 2 from post build to build step of job 1, in proper sequence

          but was thinking to implement blocking feature in this case if it was possible hence have opened the thread to discuss & cross check

          pooja shah added a comment - though for now I have worked around by moving job 2 from post build to build step of job 1, in proper sequence but was thinking to implement blocking feature in this case if it was possible hence have opened the thread to discuss & cross check

          Oleg Nenashev added a comment -

          Plugins like Flexible Publish allow invoking the common Parameterized Trigger build step from post-build actions. It should address this case

          Oleg Nenashev added a comment - Plugins like Flexible Publish allow invoking the common Parameterized Trigger build step from post-build actions. It should address this case

            huybrechts huybrechts
            pooja pooja shah
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: