【发布时间】:2017-09-27 09:42:48
【问题描述】:
我收到一条错误消息
期望用双引号括起来的属性名称:第 1 行第 3 列(字符 2)
在 Jenkins 管道上运行 AWS CLI 以创建 EC2 容器服务的任务定义。有趣的是这个脚本能够在命令行中运行而没有任何错误。
aws ecs register-task-definition --family ${FAMILY} --container-definitions "[{\"name\":\"wildfly\",\"image\":\"${REPOSITORY}\",\"memory\":3024,\"essential\":true,\"portMappings\":[{\"containerPort\":8080,\"hostPort\":8080,\"protocol\":\"tcp\"}]}]"`
这是完整的错误信息
aws ecs register-task-definition --family wildfly2-b47 --container-definitions [{name:wildfly, image:****/backend:b47, memory:3024, essential:true, portMappings:[{containerPort:8080, hostPort:8080, protocol:tcp}]}]期望用双引号括起来的属性名称:第 1 行第 3 列 (字符 2)
这是詹金斯阶段代码
stage('Deploy')
withCredentials([string(credentialsId: 'ecr-repository', variable: 'repo'),
[$class: 'AmazonWebServicesCredentialsBinding',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
credentialsId: 'ecr-credentials',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
sh '''
bash
set -x
export AWS_DEFAULT_REGION=us-west-2
CLUSTER="default"
VERSION=b${BUILD_NUMBER}
FAMILY=nxpmp2-${VERSION}
SERVICE="backend"
REPOSITORY=${repo}/backend:${VERSION}
#Register the task definition in the repository
aws ecs register-task-definition --family ${FAMILY} --container-definitions "[{"name": "wildfly", "image": ${REPOSITORY}, "memory": 3024, "essential": true, "portMappings": [{"containerPort": 8080, "hostPort": 8080, "protocol": "tcp" } ] }]"
#Update the Service
#aws ecs update-service --cluster ${CLUSTER} --region ${AWS_DEFAULT_REGION} --service ${SERVICE} --task-definition ${FAMILY}
--desired-count 1
'''
}
请帮帮我
【问题讨论】:
标签: amazon-web-services jenkins amazon-ec2 jenkins-pipeline amazon-ecs