Jenkins Active choice parameter, how to execute aws shell command with groovy
Answer a question Hi I need to get all my app versions before the pipeline starts, that is why I create Active choice parameter then write a script that will get all app versions from aws. But after s
·
Answer a question
Hi I need to get all my app versions before the pipeline starts, that is why I create Active choice parameter then write a script that will get all app versions from aws. But after some tests I get an error:
java.io.IOException: error=2, No such file or directory
Here is my script:
def region = "us-east-1"
def appName = "My app"
def command = "aws elasticbeanstalk describe-application-versions --application-name \"${appName}\" --region ${region}"
Process process = command.execute()
def out = new StringBuffer()
def err = new StringBuffer()
process.consumeProcessOutput( out, err )
process.waitFor()
if( out.size() > 0 ) println out
if( err.size() > 0 ) println err
Why the error occurs?
Answers
Try passing the command as an instance of list:
def command = ['aws', 'elasticbeanstalk', 'describe-application-versions', '--application-name', "'${appName}'", '--region', "'${region}'"]
更多推荐
已为社区贡献13073条内容
所有评论(0)