Hi Guys I'm trying to list only files names in a specific bucket in my s3 , and I got suceeded with the following command in aws cli,
aws s3 ls s3://inc-eb-deployments/my-bucket/ | awk '{ print $4 }'
But I want to add this AWS cli command in to my groovy script in Jenkins "Active Choice Parameter" Plugin, I've added it like below,
def sout = new StringBuilder(), serr = new StringBuilder()
def proc = 'aws s3 ls s3://inc-eb-deployments/my-bucket/ | awk '{ print $4 }' '.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(2000)
def values = "$sout".split('.zip')
def trimmedValues
def parameters=[]
values.each { println "${it}" }
def cleanValues = "$sout".split('inc')
def last = cleanValues.last().split('.zip')[0]
cleanValues.each { "${it}".toString();
trimmedValues = "${it}".trim();
parameters<<trimmedValues
}
parameters.remove(parameters.size() - 1);
parameters.add(last)
parameters
But When I run the Job I don't see any filename outputs on the build page.
Anyone can help me where's the issue in this Groovy script ?

