title: Jenkins pipeline optional boolean parameter
body: <p>I'm trying to utilize a custom function with a default boolean value that can be overridden. Issue is it doesn't override the default. All iterations match "else."</p>
  
  <pre><code>pipeline {
  
    agent {
      label 'any'
    }
  
    stages {
      stage('Foo') {
        steps {
          doThing('/opt/prod','athos',true)
          doThing('/opt/demo','aramis',true)
          doThing('/opt/test','porthos')
          doThing('/opt/dev','dartagnan')
        }
      }
    }
  }
  
  def doThing(def targetDir, def stackName, def prod=false) {
    if ( env.prod == true ) {
      sh """
        execute-bin \
          -Dbin.target=${targetDir} \
          -Dbin.stackName=${stackName} \
          -Dbin.prod=true
      """
    } else {
      sh """
        execute-bin \
          -Dbin.target=${targetDir} \
          -Dbin.stackName=${stackName}
      """
    }
  }
  </code></pre>