title: How to import jenkins credentials into a jenkinsfile?
body: <p>I was following the jenkinsfile <a href="https://jenkins.io/doc/book/pipeline/jenkinsfile/#handling-credentials" rel="nofollow noreferrer">documentation</a> and I tried to use a secret text in my pipeline but I got the error 
  "groovy.lang.MissingPropertyException: No such property: $AWS_SECRET_ACCESS_KEY for class: groovy.lang.Binding"</p>
  
  <p>This is my jenkinsfile. I also tried wrapping the variable like echo "${AWS_SECRET_ACCESS_KEY}" but neither works. I found an alternative solution is with a withCredentials line but I want to know why it doesn't work because I found clearer the jenkins file if I add that data as variables.</p>
  
  <p>Implementing "withCredentils" it tells me: "groovy.lang.MissingPropertyException: No such property: set for class: groovy.lang.Binding" and I found that it seems I need to downgrade my security...</p>
  
  <pre><code>pipeline {
      agent any
  
      environment {
          AWS_ACCESS_KEY     = credentials('AWS_ACCESS_KEY_ID')
          AWS_SECRET_KEY = credentials('AWS_SECRET_ACCESS_KEY')
      }
  
      stages {
          stage('Test') {
              steps {
                  echo 'Testing..'
                  echo $AWS_SECRET_KEY
                  echo $AWS_ACCESS_KEY
  
              }
          }
          stage('Deploy') {
              steps {
                  echo 'Deploying....'
                  sh "npx serverless --no-aws-s3-accelerate --key $AWS_ACCESS_KEY --secret $AWS_SECRET_KEY"
              }
          }
      }
  }
  </code></pre>
  
  <p>EDIT: fix second implementation of credentials</p>