Jenkins管道-groovy.lang.MissingPropertyException

问题描述 投票:0回答:1

[我正在尝试在Jenkins中编写管道脚本,因为我只想存储来自Docker Repo的映像名称,但是在Unix cmd中代码正在工作,但是在管道脚本中,我遇到了错误

like:groovy.lang.MissingPropertyException:No such property:x for class:groovy.lang.Binding

def Image_name =“ $(sudo docker images | grep -e'hello-world。* latest'| awk -v x = 1'{print $ x}')”

echo $ Image_name

docker jenkins jenkins-pipeline docker-swarm
1个回答
2
投票

双引号的字符串首先在groovy中插入。没有定义$x groovy变量,因此您将收到此错误。

© www.soinside.com 2019 - 2024. All rights reserved.