Pipeline "when" condition is evaluated on the node

XMLWordPrintable

    For the following code:

    pipeline {
      agent any
      stages {
        stage('Test') {
          agent { label 'nodes' }
          steps {
            sh ''' # code to run tests '''
          }
        }
        stage('Deploy') {
          when {
            branch 'master'
          }
          agent { label 'specific-node' }
          steps {
            sh ''' # code to deploy '''
          }
        }
      }
    

    The "when" condition is being evaluated on 'specific-node' and causes a bottleneck, instead of being evaluated on the master, or on the node that ran the previous stage.

          Assignee:
          Unassigned
          Reporter:
          Oren Shpigel
          Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

            Created:
            Updated: