I am Calling Groovy file In Build Command of the buildspec.yml and Would Like to Initialize An Variable in the Groovy script with An Environment Variable defined in Buildspec. How to get the Argument and initialize Variable with the Argument inside groovy. Below is my groovy script and Command.
groovysh check.groovy $fileNameList
import hudson.model.*
def nameList=fileNameList.tokenize(',')
def finalNameList=[]
for (i=0 ; i< nameList.size();i++)
{
println(nameList[i])
def sonarname="**/*"+nameList[i]+".html"
println(sonarname)
finalNameList.add(sonarname)
}
println(finalNameList)
String result = finalNameList.join(",")
def map = [sonarNameList: result]
println(map)
println(Sonar_Analysis)
return map
Need Initialize Variable fileNameList with Environment Variable $fileNameList defined in Buildspec.yml How to Implement this