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

Can't lock nodes between stages


      In an effort to balance speed with a satisfying stage view, we've taken steps to ensure that each stage runs on the same node. That way we dont have to stash/unstash too often because that is a big performance hit. For situations where we want to checkout source, configure, build and test it's fastest to just have this happen on the same workspace on the same node.

      The problem we've run into with this approach is that during that brief moment between a build and test stage for example, the node is available to all jobs and another job might grab it. We've attempted to work around this by getting clever with adding and removing node labels, but this creates all kinds of new bugs where labels don't get cleaned up or somehow a node ends up with labels from 2 different jobs at the same time.

      I thought I might have found something with https://github.com/jenkinsci/lockable-resources-plugin but that still feels like a manual process with creating "resources" that would apply to nodes and kind of faking that relationship by naming the resources the same as the nodes.

      The only way I can see at the moment to have the functionality and performance we're looking for is to combine all of the checkout+config+build+test into a single stage, but then we're losing much of what makes the pipeline workflow (and of course blue ocean) so useful.

      I would like to be able to grab an available node based on labels as I do now but have it stay reserved across stages until I explicitly say I'm done with it or the pipeline job is complete. If this can't be added as a new feature then any advice as to how to achieve this behavior with existing functionality would be much appreciated.

            Unassigned Unassigned
            rainwaj Justin Rainwater
            2 Vote for this issue
            6 Start watching this issue