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

Parameterized trigger from a multi-configuration project triggers downstream jobs twice

    Details

    • Similar Issues:

      Description

      An upstream multi-configuration project with a parameterized trigger schedules the downstream project twice.

      Log output from a multi-configuration job with two parameterized triggers (unit_test and test_suite,test_suite-valgrind):

      Triggering a new build of test_suite #21
      Triggering a new build of test_suite-valgrind #14
      Triggering a new build of unit_test #26
      Triggering a new build of test_suite #22
      Triggering a new build of test_suite-valgrind #15
      Triggering a new build of unit_test #27

        Attachments

          Activity

          Hide
          darnaut Davi Arnaut added a comment -
          • shouldTriggerBuild: unit_test
            at hudson.plugins.parameterizedtrigger.ParameterizedDependency.shouldTriggerBuild(ParameterizedDependency.java:59)
            at hudson.model.DependencyGraph$DependencyGroup.shouldTriggerBuild(DependencyGraph.java:495)
            at hudson.tasks.BuildTrigger.execute(BuildTrigger.java:186)
            at hudson.plugins.parameterizedtrigger.BuildTrigger$1.endBuild(BuildTrigger.java:95)
            at hudson.matrix.MatrixBuild$RunnerImpl.post2(MatrixBuild.java:324)
            at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:550)
            at hudson.model.Run.run(Run.java:1386)
            at hudson.matrix.MatrixBuild.run(MatrixBuild.java:152)
            at hudson.model.ResourceController.execute(ResourceController.java:88)
            at hudson.model.Executor.run(Executor.java:145)
            at hudson.model.OneOffExecutor.run(OneOffExecutor.java:61)
          • shouldTriggerBuild: unit_test
            at hudson.plugins.parameterizedtrigger.ParameterizedDependency.shouldTriggerBuild(ParameterizedDependency.java:59)
            at hudson.model.DependencyGraph$DependencyGroup.shouldTriggerBuild(DependencyGraph.java:495)
            at hudson.tasks.BuildTrigger.execute(BuildTrigger.java:186)
            at hudson.model.AbstractBuild$AbstractRunner.cleanUp(AbstractBuild.java:568)
            at hudson.model.Run.run(Run.java:1405)
            at hudson.matrix.MatrixBuild.run(MatrixBuild.java:152)
            at hudson.model.ResourceController.execute(ResourceController.java:88)
            at hudson.model.Executor.run(Executor.java:145)
            at hudson.model.OneOffExecutor.run(OneOffExecutor.java:61)
          Show
          darnaut Davi Arnaut added a comment - shouldTriggerBuild: unit_test at hudson.plugins.parameterizedtrigger.ParameterizedDependency.shouldTriggerBuild(ParameterizedDependency.java:59) at hudson.model.DependencyGraph$DependencyGroup.shouldTriggerBuild(DependencyGraph.java:495) at hudson.tasks.BuildTrigger.execute(BuildTrigger.java:186) at hudson.plugins.parameterizedtrigger.BuildTrigger$1.endBuild(BuildTrigger.java:95) at hudson.matrix.MatrixBuild$RunnerImpl.post2(MatrixBuild.java:324) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:550) at hudson.model.Run.run(Run.java:1386) at hudson.matrix.MatrixBuild.run(MatrixBuild.java:152) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:145) at hudson.model.OneOffExecutor.run(OneOffExecutor.java:61) shouldTriggerBuild: unit_test at hudson.plugins.parameterizedtrigger.ParameterizedDependency.shouldTriggerBuild(ParameterizedDependency.java:59) at hudson.model.DependencyGraph$DependencyGroup.shouldTriggerBuild(DependencyGraph.java:495) at hudson.tasks.BuildTrigger.execute(BuildTrigger.java:186) at hudson.model.AbstractBuild$AbstractRunner.cleanUp(AbstractBuild.java:568) at hudson.model.Run.run(Run.java:1405) at hudson.matrix.MatrixBuild.run(MatrixBuild.java:152) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:145) at hudson.model.OneOffExecutor.run(OneOffExecutor.java:61)
          Hide
          lneff Laura Neff added a comment -

          I wonder if the component is correct, because I'm also seeing this from a multi-configuration project when the downstream job is not parameterized.
          I'm using Downstream-Ext plugin and in my matrix job I trigger a non-parameterized job with Trigger for matrix projects set to ONLY_PARENT. Should trigger just once when all configurations finish, right? But I'm seeing two triggers in the parent log, and the job is triggered twice.

          Jenkins 1.420
          Downstream-Ext Plugin v. 1.6

          Show
          lneff Laura Neff added a comment - I wonder if the component is correct, because I'm also seeing this from a multi-configuration project when the downstream job is not parameterized. I'm using Downstream-Ext plugin and in my matrix job I trigger a non-parameterized job with Trigger for matrix projects set to ONLY_PARENT. Should trigger just once when all configurations finish, right? But I'm seeing two triggers in the parent log, and the job is triggered twice. Jenkins 1.420 Downstream-Ext Plugin v. 1.6
          Hide
          swiest Simon Wiest added a comment - - edited

          The issue is reproducable with Jenkins 1.461/Parameterized Trigger Plugin 2.13:

          1. Create a matrix job A.
          2. Create a freestyle job B.
          3. Configure a parameterized trigger in A that triggers B.
          4. Build A.
          5. The console log of the build of A shows:
            Started by user anonymous
            Triggering a new build of B #17
            B #17 is already in the queue
            Finished: SUCCESS
            

          The reason seems to be that hudson.plugins.parameterizedtrigger.BuildTrigger implements MatrixAggregatable and calls hudson.tasks.BuildTrigger.execute within the method endBuild. As triggering downstream projects is also implemented by using the dependency graph, downstream projects are effectively triggered twice.

          The solution might be simply not to implement MatrixAggregatable in hudson.plugins.parameterizedtrigger.BuildTrigger at all, because the dependency graph already handles the downstream project dependencies.

          Show
          swiest Simon Wiest added a comment - - edited The issue is reproducable with Jenkins 1.461/Parameterized Trigger Plugin 2.13: Create a matrix job A. Create a freestyle job B. Configure a parameterized trigger in A that triggers B. Build A. The console log of the build of A shows: Started by user anonymous Triggering a new build of B #17 B #17 is already in the queue Finished: SUCCESS The reason seems to be that hudson.plugins.parameterizedtrigger.BuildTrigger implements MatrixAggregatable and calls hudson.tasks.BuildTrigger.execute within the method endBuild . As triggering downstream projects is also implemented by using the dependency graph, downstream projects are effectively triggered twice. The solution might be simply not to implement MatrixAggregatable in hudson.plugins.parameterizedtrigger.BuildTrigger at all, because the dependency graph already handles the downstream project dependencies.
          Hide
          rcronk Robert Cronk added a comment -

          I'm also seeing this and sometimes the build numbers are the same, sometimes different, sometimes it just triggers them twice, sometimes it complains that they're already in the queue. When it doesn't complain, it seems to actually queue up two times and run it twice, which isn't good at all:

          15:32:05  Triggering a new build of driver-smoketest.linux #1103
          15:32:05  Triggering a new build of driver-windows.installer #1118
          15:32:05  driver-smoketest.linux #1103 is already in the queue
          15:32:06  driver-windows.installer #1118 is already in the queue
          
          13:49:25  Triggering a new build of driver-smoketest.linux #1220
          13:50:05  Triggering a new build of driver-windows.installer #1243
          13:50:06  Triggering a new build of driver-smoketest.linux #1220
          13:50:06  Triggering a new build of driver-windows.installer #1244
          
          Show
          rcronk Robert Cronk added a comment - I'm also seeing this and sometimes the build numbers are the same, sometimes different, sometimes it just triggers them twice, sometimes it complains that they're already in the queue. When it doesn't complain, it seems to actually queue up two times and run it twice, which isn't good at all: 15:32:05 Triggering a new build of driver-smoketest.linux #1103 15:32:05 Triggering a new build of driver-windows.installer #1118 15:32:05 driver-smoketest.linux #1103 is already in the queue 15:32:06 driver-windows.installer #1118 is already in the queue 13:49:25 Triggering a new build of driver-smoketest.linux #1220 13:50:05 Triggering a new build of driver-windows.installer #1243 13:50:06 Triggering a new build of driver-smoketest.linux #1220 13:50:06 Triggering a new build of driver-windows.installer #1244
          Hide
          samt Sam Talebbeik added a comment -

          We are also occasionally seeing this issue. We have a multi-configuration build job and it triggers a post build job. We are using version 2.13 of the parametrized trigger plugin, with Jenkins version Jenkins ver. 1.454 running on Ubuntu server.

          Show
          samt Sam Talebbeik added a comment - We are also occasionally seeing this issue. We have a multi-configuration build job and it triggers a post build job. We are using version 2.13 of the parametrized trigger plugin, with Jenkins version Jenkins ver. 1.454 running on Ubuntu server.
          Hide
          cjo9900 cjo9900 added a comment -

          Tracked this down to the fact that hudson.Tasks.BuildTrigger.execute() is called from AbstractBuild.cleanup() and from the Parameterizedtrigger.BuildTrigger.MatrixAggregator.endbuild().

          This seemed to be caused by commit on jenkins back in 2010-11-05

          https://github.com/jenkinsci/jenkins/commit/1d6ef2063eebaba39973c6dd56343e1912611db7

          and the change to the parameterized trigger added before it in 2010-07-01

          https://github.com/jenkinsci/parameterized-trigger-plugin/commit/3c302ccf324de5eadf5b244d2ef1ee1a78caf0d7

          So to fix this issue the parameterized trigger plugin should not create the MatrixAggregator, if the version of jenkins is newer than 1.387

          Show
          cjo9900 cjo9900 added a comment - Tracked this down to the fact that hudson.Tasks.BuildTrigger.execute() is called from AbstractBuild.cleanup() and from the Parameterizedtrigger.BuildTrigger.MatrixAggregator.endbuild(). This seemed to be caused by commit on jenkins back in 2010-11-05 https://github.com/jenkinsci/jenkins/commit/1d6ef2063eebaba39973c6dd56343e1912611db7 and the change to the parameterized trigger added before it in 2010-07-01 https://github.com/jenkinsci/parameterized-trigger-plugin/commit/3c302ccf324de5eadf5b244d2ef1ee1a78caf0d7 So to fix this issue the parameterized trigger plugin should not create the MatrixAggregator, if the version of jenkins is newer than 1.387
          Show
          cjo9900 cjo9900 added a comment - Pull request https://github.com/jenkinsci/parameterized-trigger-plugin/pull/33
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: cjo9900
          Path:
          src/main/java/hudson/plugins/parameterizedtrigger/BuildTrigger.java
          http://jenkins-ci.org/commit/parameterized-trigger-plugin/0ca4cbd2b9456b853be57bf8410bb24ee387effc
          Log:
          [FIXED JENKINS-11669] Removed MatrixAggregator

          Removed MatrixAggregator as not required after Jenkins 1.387 as
          BuildTrigger is called from AbstractBuild.cleanup() in all cases
          and we require 1.424 at the minimum.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: cjo9900 Path: src/main/java/hudson/plugins/parameterizedtrigger/BuildTrigger.java http://jenkins-ci.org/commit/parameterized-trigger-plugin/0ca4cbd2b9456b853be57bf8410bb24ee387effc Log: [FIXED JENKINS-11669] Removed MatrixAggregator Removed MatrixAggregator as not required after Jenkins 1.387 as BuildTrigger is called from AbstractBuild.cleanup() in all cases and we require 1.424 at the minimum.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: cjo9900
          Path:
          src/main/java/hudson/plugins/parameterizedtrigger/BuildTrigger.java
          http://jenkins-ci.org/commit/parameterized-trigger-plugin/86e296911721d42ccf0d03749002e753bb8ed514
          Log:
          Merge branch 'JENKINS-11669' of git://github.com/cjo9900/parameterized-trigger-plugin into 2.17-RC

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: cjo9900 Path: src/main/java/hudson/plugins/parameterizedtrigger/BuildTrigger.java http://jenkins-ci.org/commit/parameterized-trigger-plugin/86e296911721d42ccf0d03749002e753bb8ed514 Log: Merge branch ' JENKINS-11669 ' of git://github.com/cjo9900/parameterized-trigger-plugin into 2.17-RC

            People

            • Assignee:
              cjo9900 cjo9900
              Reporter:
              darnaut Davi Arnaut
            • Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: