我有两个管道,当我调用另一个共享库时,出现以下错误-
hudson.remoting.ProxyException:groovy.lang.MissingMethodException:方法的无签名:genric.call()适用于参数类型:()值:[] 可能的解决方案:wait(),any(),wait(long),main([Ljava.lang.String;),any(groovy.lang.Closure),each(groovy.lang.Closure) >
以下是我的两个文件。
genric.groovy file
#!/usr/bin/env groovy
//import hudson.model.*
pipeline{
agent any
stages{
stage('build-deploy'){
steps{
sh'''
cd /home/manish/Desktop/test/
mkdir testing
'''
}
}
}
}
Jenkinsfile
library identifier: 'genric.groovy@master', retriever: modernSCM([$class: 'GitSCMSource', credentialsId: '', remote: 'https://github.com/mani1soni/jenkins-practice.git', traits: [[$class: 'jenkins.plugins.git.traits.BranchDiscoveryTrait']]])
pipeline{
agent any
environment{
REPO_PATH='/home/manish/Desktop'
APP_NAME='test'
}
stages{
stage('calling function'){
steps{
genric()
}
}
}
}
如何解决?
答案 0 :(得分:0)
genric.groovy中使用的语法是错误的,该文件应放置在共享库回购的vars文件夹中,并遵循以下链接的“定义自定义步骤”部分中所述的语法:
答案 1 :(得分:0)
您必须重写如下内容:
vars / genric.groovy文件
call() {
sh'''
cd /home/manish/Desktop/test/
mkdir testing
'''
}
Jenkinsfile
library identifier: 'genric.groovy@master', retriever: modernSCM([$class: 'GitSCMSource', credentialsId: '', remote: 'https://github.com/mani1soni/jenkins-practice.git', traits: [[$class: 'jenkins.plugins.git.traits.BranchDiscoveryTrait']]])
pipeline{
agent any
environment{
REPO_PATH='/home/manish/Desktop'
APP_NAME='test'
}
stages{
stage('calling function'){
steps{
genric()
}
}
}
}