This is regarding the error which I am facing while executing the pipeline on Jenkins,
This is the error:
NoSuchMethodError: No such DSL method ‘awsCodeDeploy’ found among steps.
FYI, I have installed the AWS CodeDeploy plugin on Jenkins,
I have also tried using codeDeploydeploy in the post build phase, but I’m facing the same error with it too.
Can someone help me out with this? Also is there something wrong with the following code?
Following is the Jenkins pipeline code:
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git 'https://github.com/blablabla......'
}
}
stage('Build') {
steps {
sh 'chmod +x build.sh'
sh './build.sh'
}
}
stage('Deploy') {
steps {
withAWS(region: 'us-east-1', credentials: 'aws-credentials-id') {
s3Upload(bucket: 'my-web-app-bucketxyz', path: 'webapp.zip', file: 'webapp.zip')
}
}
}
}
post {
success {
script {
withAWS(region: 'us-east-1', credentials: 'aws-credentials-id') {
awsCodeDeploy applicationName: 'MyWebApp', deploymentGroupName: 'MyWebAppDeploymentGroup', s3Location: 's3://my-web-app-bucketxyz/webapp.zip'
}
}
}
failure {
echo 'Build or deployment failed.'
}
}
}
FYI, I have installed the AWS CodeDeploy plugin on Jenkins,
I have also tried using codeDeploydeploy in the post build phase, but I’m facing the same error with it too.
1
Looks like you are missing the brackets after awsCodeDeploy
. Try this:
withAWS(region: 'us-east-1', credentials: 'aws-credentials-id') {
awsCodeDeploy(
applicationName: 'MyWebApp',
deploymentGroupName: 'MyWebAppDeploymentGroup',
s3Location: 's3://my-web-app-bucketxyz/webapp.zip'
)
}