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

Conditionals allOf anyOf and not behaving backwards

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline
    • None
    • Pipeline-plugin version 2.6

      Running into an issue with the behavior of the 'allOf' vs 'anyOf'. I have the following pipeline script:

       

      pipeline { 
        agent any
        stages { 
          stage('Checking Test') { 
            when { 
              anyOf { 
               not { expression { return params.forceTest } } 
               not { expression { return params.newTest } } 
              } 
            } 
            steps { 
              echo "I'm Running!!!" 
            } 
          } 
        } 
      }

       

      The two parameters (boolean checkboxes) are both required to be true in order for the step to be skipped. If only one is true and the other is false the step will execute.

      However, using this code:

       

      pipeline { 
        agent any
        stages { 
          stage('Checking Test') { 
            when { 
              allOf { 
                not { expression { return params.forceTest } } 
                not { expression { return params.newTest } } 
              }
            } 
            steps { 
              echo "I'm Running!!!" 
            } 
          } 
        } 
      }

       

      Any of the parameters can be true and it will not run (it will be skipped). 

      This is obvious backwards in logic.

            Unassigned Unassigned
            maddmaxx Zack Nunez
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: