title: How to do I user an environmental variable as a parameter in Jenkins
body: <p>I am trying to write a Jenkins pipeline that calls a Python script. I would like to use the userId of the Jenkins user as an argument when calling the pipeline script. At the moment this looks something like:</p>
  <pre><code>wrap([$class: 'BuildUser']) {
             String user = env.BUILD_USER_ID     
    }
                       
  sh &quot;sshpass -p ${password} ssh -o StrictHostKeyChecking=no ${user}@${NODE} python3 git_handler.py ${user} ${password} ${remoteRepository} ${localDirectory} ${branch}&quot; 
  </code></pre>
  <p>However, I receive a message saying: &quot;java.lang.ClassCastException: org.jenkinsci.plugins.workflow.steps.ErrorStep.message expects class java.lang.String but received class groovy.lang.MissingPropertyException&quot;.</p>
  <p>When I print the variable $(user) I receive the correct userId. Why can I not pass it as a parameter?</p>
  <p>(The other four parameters I am taking as user input before building the pipeline, and they all work correctly).</p>