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

Pipeline "when" condition is evaluated on the node

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          trejkaz trejkaz added a comment -

          What if you use `beforeAgent true`?

          Show
          trejkaz trejkaz added a comment - What if you use `beforeAgent true`?

            People

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

              Dates

              Created:
              Updated: