stage ('Build image') {
steps {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'user', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
sh "tempPass=\$(aws ecr get-login-password --region us-west-2)"
echo 'Hello------------------'
echo "${tempPass}"
echo 'Hello AFTER------------------'
}
}
}
Exception : groovy.lang.MissingPropertyException: No such property: pass for class: groovy.lang.Binding
I have tried echo "$tempPass" as well but does not work.
I tried this as well but variable value is coming in as null.
script {
tempPass=sh(script: "aws ecr get-login-password --region us-west-2")
}
Can anyone help here?