hudson.remoting.ProxyException:groovy.lang.MissingMethodException:方法没有签名:

时间:2018-12-13 12:33:32

标签: jenkins jenkins-pipeline dockerhub

"hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: org.jenkinsci.plugins.docker.workflow.Docker.minus() is applicable for argument types: (java.lang.String) values: [/var/lib/jenkins] Possible solutions: find(), image(java.lang.String), is(java.lang.Object), find(groovy.lang.Closure), any(), build(java.lang.String)"

下面是我的脚本,为什么我遇到了以上错误?请帮助我解决此错误

node{
    stage('Login to server') {
        sshagent(['ssh-login']) {
            sh 'ssh -o StrictHostKeyChecking=no  Server_name'
            withCredentials([string(credentialsId: 'dockerhubpwd', variable: 'docker-pwd')]) {
                sh "docker -u my_username -p ${docker-pwd}"
            }

        }
    } }

1 个答案:

答案 0 :(得分:0)

要么将最后一个sh命令替换为

sh "docker -u my_username -p ${env.'docker-pwd'}"

或者每次出现的docker-pwd变量都被重命名为dockerPwd(或任何不带破折号的值)