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}'"]
Logo

CI/CD社区为您提供最前沿的新闻资讯和知识内容

更多推荐