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

Stopping a parent job doesn't stop the triggered child jobs

      Assume you have a job A that launch a child Job B and that job A has to wait Job B finished to continue its steps.

      If you stopped job A while job B is processing, the job B isn't stopped.
      It should be stopped.

      Precondition:
      I have a parent job "Parent" that triggers child jobs "Child(1-N)", and then blocks waiting for them to finish.

      Action:
      1. Start Parent job.
      2. Wait for children to launch.
      3. Abort Parent job.

      Current result: 
      Parent job aborts but children continue to run. If the child jobs have no meaning outside of the parent, then child jobs have to be manually aborted.

      I can see why you would want this behavior. It is certainly the correct behavior in the "post-build step" case. It is probably correct in the "non-blocking build step" case. In the case of the parent build blocking on children completing, there are definitely scenarios where it is not.

      Desired Enhancement:
      When "Block on child job completion" checkbox is checked, a list of options is shown. Add option to the list: "Child job action when parent job is aborted". Values: "None, continue running (default)", "Abort immediately".

          [JENKINS-11257] Stopping a parent job doesn't stop the triggered child jobs

          Nicolas Godelu created issue -
          Jonathan Gonzalez made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Nicolas Godelu made changes -
          Summary Original: Stopping a prent job doesn't stop the trgiggered child jobs New: Stopping a parent job doesn't stop the triggered child jobs

          I vote for this issue. At the moment we use the workaroud groovy postbuild script which checks if build has been aborted, then gets the chilren and executes build.doStop() on them.

          Nickolay Rumyantsev added a comment - I vote for this issue. At the moment we use the workaroud groovy postbuild script which checks if build has been aborted, then gets the chilren and executes build.doStop() on them.
          Nickolay Rumyantsev made changes -
          Link New: This issue is duplicated by JENKINS-20273 [ JENKINS-20273 ]

          ikedam added a comment -

          This is not a bug, nor critical.

          ikedam added a comment - This is not a bug, nor critical.
          ikedam made changes -
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]
          Priority Original: Critical [ 2 ] New: Major [ 3 ]

          Sebastian Schuberth added a comment - - edited

          nickolayr Would you mind sharing your script?

          Sebastian Schuberth added a comment - - edited nickolayr Would you mind sharing your script?

          Haiqing Zhang added a comment -

          Is there any updates on this issue? Could you please fix this or provide a work around? Thanks.

          Haiqing Zhang added a comment - Is there any updates on this issue? Could you please fix this or provide a work around? Thanks.
          Sebastian Schuberth made changes -
          Link Original: This issue is duplicated by JENKINS-20273 [ JENKINS-20273 ]

            huybrechts huybrechts
            nicolas_godelu Nicolas Godelu
            Votes:
            31 Vote for this issue
            Watchers:
            33 Start watching this issue

              Created:
              Updated: