本文介绍了jenkinsfile无法识别@Grab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用@Grab在我的Jenkinsfile中包含一个yaml解析库.我将这一行添加到我的Jenkinsfile中:
I want to use @Grab to include a yaml parsing library inside my Jenkinsfile. I add this line in my Jenkinsfile:
@Grab('org.yaml:snakeyaml:1.17')
https://bitbucket.org/asomov/snakeyaml
但是,Jenkins跑步无法识别此错误并返回错误.
However, the Jenkins run can't recognize this and return an error.
推荐答案
目前您不能在管道中使用@Grab
.我怀疑它将添加为功能,因为Jenkins CPS需要源代码才能执行CPS转换,并且@Grab
使用二进制依赖性.您只能从受信任的共享库中使用@Grab
.来自文档:
You cannot use @Grab
in pipelines at the moment. I doubt it will be added as a feature because Jenkins CPS needs source code to be able to perform CPS transofmrations, and @Grab
uses binary dependencies. You can only use @Grab
from trusted shared libraries. From the docmentation:
这篇关于jenkinsfile无法识别@Grab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!