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

Assignment in if statements does not work

XMLWordPrintable

      The following fails in pipeline scripts (the if statement always evaluates to false)

      def getStatus(){
       // ....
       "Ready"
      }
      
      //....
      
      
      def acceptedStatuses = ["Ready", "Updated", "Failed" ]
      def status
      if(acceptedStatuses.contains((status = getStatus()))){
         // never called
      }
      
      
      

            Unassigned Unassigned
            zhelyan Zhelyan Panchev
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: