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

Job triggered multiple times by maven dependencies

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: pipeline-maven-plugin
    • Labels:
      None
    • Environment:
      CentOS Linux release 7.5.1804 (Core)
      org.jenkins-ci.main:jenkins-war:2.150.2
      pipeline-maven-3.6.7
    • Similar Issues:

      Description

      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/

        Attachments

          Activity

          Hide
          cleclerc Cyrille Le Clerc added a comment -

          Richard Vobl thank you very much for the pull request. Can you please confirm that my diagram above is a correct understanding of the dependencies between projects?

          Show
          cleclerc Cyrille Le Clerc added a comment - Richard Vobl thank you very much for the pull request. Can you please confirm that my diagram above is a correct understanding of the dependencies between projects?
          Hide
          amir_schnell Richard Vobl added a comment -

          Yes I think this is a good representation

          Show
          amir_schnell Richard Vobl added a comment - Yes I think this is a good representation
          Hide
          cleclerc Cyrille Le Clerc added a comment -

          Richard Vobl thanks! I didn't catch that you proposed a pull request. I'll review ASAP
          https://github.com/jenkinsci/pipeline-maven-plugin/pull/202

          Show
          cleclerc Cyrille Le Clerc added a comment - Richard Vobl thanks! I didn't catch that you proposed a pull request. I'll review ASAP https://github.com/jenkinsci/pipeline-maven-plugin/pull/202
          Show
          cleclerc Cyrille Le Clerc added a comment - - edited Richard Vobl can you please test https://github.com/jenkinsci/pipeline-maven-plugin/releases/tag/pipeline-maven-3.6.8-beta-2 ?
          Hide
          amir_schnell Richard Vobl added a comment -

          Cyrille Le Clerc I have tested the linked release and can confirm that it solves the issue described here.

          Show
          amir_schnell Richard Vobl added a comment - Cyrille Le Clerc I have tested the linked release and can confirm that it solves the issue described here.
          Hide
          cleclerc Cyrille Le Clerc added a comment -

          Solved in 3.6.8

          Show
          cleclerc Cyrille Le Clerc added a comment - Solved in 3.6.8

            People

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

              Dates

              • Created:
                Updated:
                Resolved: