jenkinsci / pipeline-aws-plugin

Jenkins Pipeline Step Plugin for AWS
https://plugins.jenkins.io/pipeline-aws/
Apache License 2.0
431 stars 203 forks source link

No such DSL method 'AWS' found among steps error in jenkins pipeline #311

Open giridhar08 opened 1 year ago

giridhar08 commented 1 year ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.361.4 OS: Linux - 5.15.0-1023-aws Java: 11.0.18 - Ubuntu (OpenJDK 64-Bit Server VM) ```

Getting the below error while running withAWS command on jenkins inbound-agent docker container.

Requesting assume role
Assuming role ARN is arn:aws:iam::xxxxxxxxxxxxxxxxx:role/cross-account-roleAssumed role arn:aws:sts::xxxxxxxxxxxxxx:assumed-role/cross-account-role/Jenkins-59 with id xxxxxxxxxxxxxxx:Jenkins-xxxxxxxxx-59 
 [Pipeline] {
[Pipeline] }
[Pipeline] // withAWS
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] End of Pipeline
java.lang.NoSuchMethodError: No such DSL method 'AWS' found among steps  
stage('List staging eks cluster') {
            agent {
                label 'jenkins-jnlp'
            }
            steps {
                withAWS(roleAccount:'xxxxxxxxxx', role:'cross-account-role') {
                    AWS("--region=eu-north-1 eks list-clusters")
                }
            }
        }
    }

What Operating System are you using (both controller, and any agents involved in the problem)?

Controller OS: Linux Agent: jenkins inbound-docker agent (https://hub.docker.com/r/jenkins/inbound-agent/)

Reproduction steps

  1. Installed AWS pipeline plugin and selected "Retrieve credentials from node" checkbox under Jenkins "Configure System"
  2. Created pipeline script with below syntax

stage('List staging eks cluster') { agent { label 'jenkins-jnlp' } steps { withAWS(roleAccount:'xxxxxxxxxx', role:'cross-account-role') { AWS("--region=eu-north-1 eks list-clusters") } } } }

  1. Build run

Expected Results

Should assume the role successfully and run the aws cli command

Actual Results

Got below error output

Requesting assume role Assuming role ARN is arn:aws:iam::xxxxxxxxxxxxxxxxx:role/cross-account-roleAssumed role arn:aws:sts::xxxxxxxxxxxxxx:assumed-role/cross-account-role/Jenkins-59 with id xxxxxxxxxxxxxxx:Jenkins-xxxxxxxxx-59 [Pipeline] { [Pipeline] } [Pipeline] // withAWS [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] End of Pipeline java.lang.NoSuchMethodError: No such DSL method 'AWS' found among steps

Anything else?

No response

bkowenswork commented 1 month ago

I can confirm that this is present in 1.45 as well