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

Order Buildque / Block Projects for Upstream Projects

    • Icon: Patch Patch
    • Resolution: Fixed
    • Icon: Major Major
    • other
    • None
    • Platform: All, OS: All

      This patch blocks AbstractProject from beeing build while any tranisitive
      Upstream Project is in the Queue or beeing build.
      Effectivly the buildque is processed in reverse dependency order.

      I would have liked to put this in a plugin rather than a patch but found no easy
      way. If theres a change I can commit the patch I could make the behaviour
      configurable through the hudson configuration page.

          [JENKINS-1938] Order Buildque / Block Projects for Upstream Projects

          martinficker added a comment -

          Created an attachment (id=296)
          The patch again "main"

          martinficker added a comment - Created an attachment (id=296) The patch again "main"

          Thank you very much for a patch. But for reasons discussed in the ML in the
          past, I'm afraid we can't accept this change.

          As an example, I have a job that replicates the contents of our internal staging
          Maven repository to external mirrors. This is hooked up as a downstream of many,
          many projects.

          Now, I do want this downstream to run each time when any of those upstream
          completes. I don't want the blocking behavior.

          Upstream/downstream is also used to run different stages of a build (like build
          and test) in parallel. This patch kills the efficiency gain in doing this.

          We do need to make some improvements for the diamond dependency case, but I'm
          afraid this is not the solution.

          Kohsuke Kawaguchi added a comment - Thank you very much for a patch. But for reasons discussed in the ML in the past, I'm afraid we can't accept this change. As an example, I have a job that replicates the contents of our internal staging Maven repository to external mirrors. This is hooked up as a downstream of many, many projects. Now, I do want this downstream to run each time when any of those upstream completes. I don't want the blocking behavior. Upstream/downstream is also used to run different stages of a build (like build and test) in parallel. This patch kills the efficiency gain in doing this. We do need to make some improvements for the diamond dependency case, but I'm afraid this is not the solution.

          mdonohue added a comment -
              • Issue 3388 has been marked as a duplicate of this issue. ***

          mdonohue added a comment - Issue 3388 has been marked as a duplicate of this issue. ***

          mdonohue added a comment -
              • Issue 4137 has been marked as a duplicate of this issue. ***

          mdonohue added a comment - Issue 4137 has been marked as a duplicate of this issue. ***

          mdonohue added a comment -
              • Issue 4365 has been marked as a duplicate of this issue. ***

          mdonohue added a comment - Issue 4365 has been marked as a duplicate of this issue. ***

          mdonohue added a comment -

          There was a thread on the dev mailing list about adding a method to core that
          would make this feature very easy to do in a plugin. I'm pretty sure Kohsuke
          added the proposed patch.

          http://www.nabble.com/Queue-handling-contribution-tt24322512.html

          mdonohue added a comment - There was a thread on the dev mailing list about adding a method to core that would make this feature very easy to do in a plugin. I'm pretty sure Kohsuke added the proposed patch. http://www.nabble.com/Queue-handling-contribution-tt24322512.html

          mdonohue added a comment -

          Reopening due to continued interest in this feature.

          mdonohue added a comment - Reopening due to continued interest in this feature.

          Andrew Bayer added a comment -

          This is actually already in place as an advanced option on Maven projects. Let
          me see if I can generalize it easily.

          Andrew Bayer added a comment - This is actually already in place as an advanced option on Maven projects. Let me see if I can generalize it easily.

          Andrew Bayer added a comment -

          Ah, and yes, hudson.model.Queue.QueueDecisionHandler, the extension point for
          this sort of functionality, has been added. I don't know if anything actually
          uses it yet, though.

          Andrew Bayer added a comment - Ah, and yes, hudson.model.Queue.QueueDecisionHandler, the extension point for this sort of functionality, has been added. I don't know if anything actually uses it yet, though.

          Andrew Bayer added a comment -

          On looking at this further, I don't think QueueDecisionHandler is the way to go

          • that blocks a job from being scheduled at all, when what we want here is to
            keep a job in the queue but unlaunched until its upstream projects/dependencies
            have finished. I'm pretty sure this won't be hard to do by pushing up the logic
            from AbstractMavenProject's isBuildBlocked and related methods to
            AbstractProject - I'll test this out and hopefully get it into 1.323.

          Andrew Bayer added a comment - On looking at this further, I don't think QueueDecisionHandler is the way to go that blocks a job from being scheduled at all, when what we want here is to keep a job in the queue but unlaunched until its upstream projects/dependencies have finished. I'm pretty sure this won't be hard to do by pushing up the logic from AbstractMavenProject's isBuildBlocked and related methods to AbstractProject - I'll test this out and hopefully get it into 1.323.

          Code changed in hudson
          User: : abayer
          Path:
          trunk/hudson/main/core/src/main/java/hudson/model/AbstractProject.java
          trunk/hudson/main/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly
          trunk/hudson/main/core/src/main/resources/hudson/model/Messages.properties
          trunk/hudson/main/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly
          trunk/hudson/main/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding_ja.properties
          trunk/hudson/main/maven-plugin/src/main/java/hudson/maven/AbstractMavenProject.java
          trunk/hudson/main/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly
          trunk/hudson/main/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries_ja.properties
          trunk/www/changelog.html
          http://fisheye4.cenqua.com/changelog/hudson/?cs=21323
          Log:
          [FIXED JENKINS-1938] Moved Maven project's block when upstream is building functionality up to AbstractProject. Now available as advanced option for all project types

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : abayer Path: trunk/hudson/main/core/src/main/java/hudson/model/AbstractProject.java trunk/hudson/main/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly trunk/hudson/main/core/src/main/resources/hudson/model/Messages.properties trunk/hudson/main/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly trunk/hudson/main/core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding_ja.properties trunk/hudson/main/maven-plugin/src/main/java/hudson/maven/AbstractMavenProject.java trunk/hudson/main/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly trunk/hudson/main/maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries_ja.properties trunk/www/changelog.html http://fisheye4.cenqua.com/changelog/hudson/?cs=21323 Log: [FIXED JENKINS-1938] Moved Maven project's block when upstream is building functionality up to AbstractProject. Now available as advanced option for all project types

          Andrew Bayer added a comment -

          The Maven project's block-when-upstream-building option is now available for
          all project types, as of 1.323. It's an advanced option, and is off by default.

          Andrew Bayer added a comment - The Maven project's block-when-upstream-building option is now available for all project types, as of 1.323. It's an advanced option, and is off by default.

            Unassigned Unassigned
            martinficker martinficker
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: