Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57075

AWS credentials should not require workspace

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • aws-credentials-plugin
    • None
    • Jenkins:2.150.3
      aws-credentials:1.26

      The AWS Credentials plugin seems to require a workspace, and I'm not sure why:

      withCredentials([[
              $class: 'AmazonWebServicesCredentialsBinding',
              credentialsId: 'aws-creds',
              accessKeyVariable: 'AWS_ACCESS_KEY_ID',
              secretKeyVariable: 'AWS_SECRET_KEY'
      ]]) {
              // perform some remote operation using the AWS creds
      }
      

      causes

      org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing
      Perhaps you forgot to surround the code with a step that provides this, such as: node, dockerNode
      	at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution2.doStart(BindingStep.java:132)
      	at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:77)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

      But the following is fine:

      node('some-node') {
          withCredentials([[
                  $class: 'AmazonWebServicesCredentialsBinding',
                  credentialsId: 'aws-creds',
                  accessKeyVariable: 'AWS_ACCESS_KEY_ID',
                  secretKeyVariable: 'AWS_SECRET_KEY'
          ]]) {
              // perform some remote operation using the AWS creds
          }
      }
      

      Since this credential type seems to be managing two variables as strings (accessKeyVariable / secretKeyVariable), can the need for a workspace be removed?

            robin_smith Robin Smith
            robin_smith Robin Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: