1
仍然通过我第一次使用Groovy脚本来解决问题,并且我遇到了另一个障碍。我将Jenkins 2 freestyle工作转换为管道工作,并且我无法在Groovy中找到eval $(aws ecr get-login --region us-east-1)
的等效项。如何在Groovy脚本中执行'aws ecr get-login'
研究表明解决方案应该是类似Eval.me('aws ecr get-login --region us-east-1')
但这会导致以下错误;
Caught: groovy.lang.MissingMethodException: No signature of method: test2.node() is applicable for argument types: (java.lang.String, test2$_run_closure1) values: [on-demand-t2small, [email protected]]
Possible solutions: notify(), wait(), run(), run(), dump(), grep()
groovy.lang.MissingMethodException: No signature of method: test2.node() is applicable for argument types: (java.lang.String, test2$_run_closure1) values: [on-demand-t2small, [email protected]]
Possible solutions: notify(), wait(), run(), run(), dump(), grep()
我GOOGLE了错误,但像this和this产生的计算器答案是如此具体到他们的情况下,我作为一个Groovy小白,无法理解的解决方案。任何帮助(与解释为什么这是解决方案),表示赞赏。
我不知道我的脚本的其余部分是否相关;如果是这样,请让我知道,我可以编辑添加它。
您的问题标题并未反映您实际询问的问题。您正在寻找该AWS CLI命令的替代方案,您正在寻找从Groovy执行shell命令的正确方法。如果您真的想在Groovy中使用AWS CLI命令的替代方案,那么您需要考虑使用AWS SDK for Java。 –
另请注意,错误消息'No signature of method:test2.node()'似乎与您在问题中包含的代码无关。我认为你的错误是在不同的代码行上。 –
@MarkB我对糟糕的措辞不利,我会编辑并解决这个问题。你碰巧有一个解决方案?我想我正在寻找在Groovy中执行shell命令。 – Alex