pipeline {
  agent { label 'linux' }
  stages {
    stage('Use the token') {
      steps {
        withCredentials([string(credentialsId: 'api-token', variable: 'TOKEN')]) {
          sh 'echo "length: ${#TOKEN}"'
          sh 'echo "plain: $TOKEN"'
        }
        sh 'echo "after the block: ${TOKEN:-unset}"'
      }
    }
  }
}
