groovy.lang.MissingMethodException:没有方法签名:为什么 Jenkins 共享管道库会出现此错误?

groovy.lang.MissingMethodException: No signature of method: Why is this error coming for Jenkins Shared Pipeline library?

我有一个共享管道库code。该库隐式加载到我的 Jenkins 中,我在我的 Jenkins 文件中使用以下代码调用其中一种方法:

node {
    CheckOut {}
}

我也尝试过使用 CheckOut.call() & CheckOut.call([:],{}) 但无济于事。 不断收到以下错误:

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: CheckOut.call() is applicable for argument types: (org.jenkinsci.plugins.workflow.cps.CpsClosure2) values: [org.jenkinsci.plugins.workflow.cps.CpsClosure2@668faf1f]
Possible solutions: call(), wait(), any(), wait(long), main([Ljava.lang.String;), any(groovy.lang.Closure)

P.S。 - 该错误并非特定于一个函数,库的所有其他函数也会发生。

发现问题。在 Jenkins 全局配置中配置共享库 repo 时,填写 link 不带 .git 最后。

例如,使用https://github.com/arghyadeep-k/jenkins-shared-library and not https://github.com/arghyadeep-k/jenkins-shared-library.git.

然后,调用 Jenkinsfile 中的函数

node{
    checkOut.call()
}