admin管理员组文章数量:1400375
I have a jenkinsfile in git branch "my-branch" that imports a class.
@Library('my-branch') _
import foo.bar.info.stuff
However sometimes I create copies of the branch for testing e.g my-branch-2 the jenkinsfile will point to the original branch due to the hardcoded branch name.
I tried to fix as so
def branch = scm.branches[0].name.with{ b -> b.substring( (b.startsWith('*/') ? 2 : 0)) }
library("${branch}")
import foo.bar.info.stuff
But this just gets "unable to resolve class". Same happens if I remove the library statement entirely. Is there a way to have it point to the current branch?
本文标签: Is there a way to use a shared library in Jenkins without hardcoding the branch nameStack Overflow
版权声明:本文标题:Is there a way to use a shared library in Jenkins without hardcoding the branch name? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744175428a2593977.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论