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

build-blocker-plugin does not block on node level for pipeline projects

      Have integrated Jenkins with Atlassian Bitbucket where I trigger what we call "pre-merge" builds. This means once pull-requests are ready for merge we start a job that checks that they are really ready for merge. A failed build will prevent the merge. 

      Any change on the target branch, or the source branch will trigger a new build. Since there are several pull requests that wants to merge to the develop branch many jobs can be triggered simultanously causing 2-3 or even more build jobs to be queued at once.  

      We have 2 build slaves/agents that I have given the same label so they can be used simultanously to balance the load so to speak.

      Now then, in the job, I have  entered a restriction for where this job can execute in the "Label expression": 'label-that-sits-on-two-slaves'.

      I have also entered a "Blocking jobs" -name like ABC* and then selecting the "block on node level" which leads me to believe that this would allow one of the "pre-merge" builds to use one of our agents and a second one to use the other slave and this seems to work for NON-PIPELINE jobs. 

      Doing the same for a pipeline job, where specifying:

      agent { label: 'label-that-sits-on-two-slaves' }
      

      does not work.

       

      What is required to be able to automatically distribute a build-job on two or more agents simultanously and prevent them from running at the same time on the same agent using pipeline scripts?

       

       

          [JENKINS-50187] build-blocker-plugin does not block on node level for pipeline projects

          Denis Mone added a comment -

          We are facing the same issue in my company.

          I'd like to take this ticket and start working out a solution for the plugin.

          Denis Mone added a comment - We are facing the same issue in my company. I'd like to take this ticket and start working out a solution for the plugin.

          Denis Mone added a comment -

          I've managed to fix the issue at least locally, by adding an additional check for the ownerTask of the item, and returning the property afterwards.

          Denis Mone added a comment - I've managed to fix the issue at least locally, by adding an additional check for the ownerTask of the item, and returning the property afterwards.

          Kent Granström added a comment - - edited

          dmone: It appears to work. Added your patch and a first test indicates it works! 

          Kent Granström added a comment - - edited dmone : It appears to work. Added your patch and a first test indicates it works! 

          anup kumar added a comment - - edited

          kengra1 Is it this patch released i,m facing same issue

          anup kumar added a comment - - edited kengra1 Is it this patch released i,m facing same issue

          akp As far as I know, it isn't. I just  applied the patch and it did work so I have compiled it locally and installed it 

          Kent Granström added a comment - akp As far as I know, it isn't. I just  applied the patch and it did work so I have compiled it locally and installed it 

          Denis Mone added a comment - - edited

          I've filled the PR#13 on project repository. Unfortunately the tests fail when running against windows8, so i 'll need to fix that in order to have the PR pass cleanly.

          Denis Mone added a comment - - edited I've filled the PR#13 on project repository. Unfortunately the tests fail when running against windows8, so i 'll need to fix that in order to have the PR pass cleanly.

          Denis Mone added a comment - - edited

          In order to make the tests pass i added an

          @Extension(optional = true)
          

          on BuildBlockerQueueTaskDispatcher class

          Found the solution from comment#5 on a similar bug for cobertura plugin

          Denis Mone added a comment - - edited In order to make the tests pass i added an @Extension(optional = true ) on BuildBlockerQueueTaskDispatcher class Found the solution from comment#5 on a similar bug for cobertura plugin

          Denis Mone added a comment - - edited

          I've fixed this issue on PR#13 and merged.
          I've also released on version 1.7.5
          tested it on our company Jenkins instance and it works for both scripted and declarative pipelines

          Denis Mone added a comment - - edited I've fixed this issue on PR#13 and merged. I've also released on version 1.7.5 tested it on our company Jenkins instance and it works for both scripted and declarative pipelines

            dmone Denis Mone
            kengra Kent Granström
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: