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

Job triggered multiple times by maven dependencies

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • None
    • CentOS Linux release 7.5.1804 (Core)
      org.jenkins-ci.main:jenkins-war:2.150.2
      pipeline-maven-3.6.7

      I have an issue with the plugin, which causes projects to be built multiple times, where it is intended that they are only built once.

      I have a maven project, lets call it A, which consists of multiple maven modules A.a, A.b, ... Now i have a project B, which has a dependency on A.a and A.b. I also have a project C which has a dependency A.b, as well as on modules of B.

      They all have their own pipelines.

      Now when executing a build on A, the build of B should be invoked by A and then the build of C should be invoked by B.

      But this doesnt happen. Instead A triggers B and C, and then B again triggers C, so that C is build twice.

      I invesitgated your code and the problem seems to be the following:

      After the build of a is done, a listener of the plugin is invoked, to check which builds should be triggered afterwards. Every module of the project is checked, if it has dependant projects, which must be triggered. Here the problem arises: The first module that is checked, A.a only has C as dependant project, so C is marked as job that should be triggered. When A.b is checked, the code notices, that C is already marked as to be trifggered, so it skips the calculation. Here lies the error, this calculation should be done, so it is recognized, that C will be built by B.

      I created a pull request pull 202, please let me know what you think about it.

            +--------------+
            |              |
            |   +-----+    |                +-------+
            |   | A.a +--------------------->   B   +-----+
            |   +-----+    |           ^    +-------+     |
            |   +-----+    |           |                  |
            |   | A.b +----------------+                  |
            |   +-----+    |           |                  |  +----+
            |              |           +----------------->-->+ C  |
            +--------------+                                 +----+
      

      http://asciiflow.com/

            cleclerc Cyrille Le Clerc
            amir_schnell Richard Vobl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: