title: How to pass pipeline credential parameter to python script as env variable
body: <p>I have a pipeline job with a credential parameter (user name and password), and also a groovy file that runs a shell script which triggers python file.
  How can I pass those parameters to the env so the python script can use them with os.getenv?
  Groovy file code:</p>
  
  <pre><code>def call() {
      final fileContent = libraryResource('com/amdocs/python_distribution_util/main.py')
      writeFile file: 'main.py', text: fileContent
  
      sh "python main.py"}
  </code></pre>
  
  <p>I know the pipeline-syntax should look something similar to that:</p>
  
  <pre><code>withCredentials([usernamePassword(credentialsId: '*****', passwordVariable: 'ARTIFACTORY_SERVICE_ID_PW', usernameVariable: 'ARTIFACTORY_SERVICE_ID_UN')]) {
      // some block
  }
  </code></pre>
  
  <p>what is the correct way for doing it?</p>
  
  <p><a href="https://i.stack.imgur.com/EZmPH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EZmPH.png" alt="credential parameter from the jenkins pipeline"></a></p>