Amazon web services 如何在groovy中计算美元表达式并存储值

Amazon web services 如何在groovy中计算美元表达式并存储值,amazon-web-services,groovy,jenkins-groovy,groovyshell,Amazon Web Services,Groovy,Jenkins Groovy,Groovyshell,我需要使用Jenkins文件groovy检索AWS中任务定义的修订版。下面的代码在shell脚本下对我有效,但我无法让它对我的Jenkins文件groovy有效。其他变量(如props.region等)来自属性文件,我已经使用以下方法获取这些变量:- def调用(映射配置=[:]){ def deployDefinition=libraryResource“deployDefinitions/ecs/${config.deployApplication}/${config.deployEnvi

我需要使用Jenkins文件groovy检索AWS中任务定义的修订版。下面的代码在shell脚本下对我有效,但我无法让它对我的Jenkins文件groovy有效。其他变量(如props.region等)来自属性文件,我已经使用以下方法获取这些变量:-

def调用(映射配置=[:]){
def deployDefinition=libraryResource“deployDefinitions/ecs/${config.deployApplication}/${config.deployEnvironment}.properties”
def props=readProperties(文本:deployDefinition)
使用凭据([[$class:'AmazonWebServicesCredentialsBinding',accessKeyVariable:'AWS_ACCESS_KEY_ID',credentialsId:${props.awsCreds}],secretKeyVariable:'AWS_SECRET_ACCESS_KEY'])){
def newimageurl=“${props.registry}/${props.imagename}:${IMAGE_TAG}”
def oldimageurl=“${props.registry}/${props.imagename}”
sh“sed-i-e的#${oldimageurl}#${newimageurl}#'./taskdef.json”
sh“aws ecs注册任务定义--系列${props.family}--cli输入json文件://${WORKSPACE}/taskdef.json--区域${props.region}”
修订=$(aws ecs描述任务定义--任务定义${props.task_def_name}--区域${props.region}| jq.taskDefinition.REVISION)
sh“aws ecs更新服务--集群${props.cluster}--区域${props.region}--服务${props.service_name}--任务定义${props.task_def_name}:$REVISION”
}

}
我通过以下方法实现了这一点:-

sh“aws ecs描述任务定义--任务定义${props.task_def_name}--区域${props.region}| jq.taskDefinition.revision>output.txt”
def REVISION=readFile“${WORKSPACE}/output.txt”
sh“aws ecs更新服务--cluster${props.cluster}--region${props.region}--服务${props.service_name}--任务定义${props.task_def_name}:$REVISION”