Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-69055

SSH Steps Plugin won't run in Jenkinsfile

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • ssh-steps-plugin
    • None
    • Jenkins 2.346.2 on Docker

      Hello!
      I recently started using Jenkinsfile to describe my pipelines and I got stuck in script integration always receiving when I give Build I get this error:

      Hello!
      I recently started using Jenkinsfile to describe my pipelines and got stuck in script integration by always getting the error below when I try to run the pipeline:

      [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /var/jenkins_home/workspace/petheart_staging [Pipeline] { [Pipeline] withCredentials Masking supported pattern matches of $identity or $userName [Pipeline] { [Pipeline] stage [Pipeline] { (PHP Artisan Remote Migrations) [Pipeline] sshCommand [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withCredentials [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline groovy.lang.MissingPropertyException: No such property: name for class: java.lang.String at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:66) at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:65) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:299) at org.jenkinsci.plugins.sshsteps.util.Common.validateRemote(Common.groovy:34) at org.jenkinsci.plugins.sshsteps.util.Common$validateRemote.callCurrent(Unknown Source) at org.jenkinsci.plugins.sshsteps.util.Common.validateRemote(Common.groovy:48) at org.jenkinsci.plugins.sshsteps.util.Common$validateRemote.call(Unknown Source) at org.jenkinsci.plugins.sshsteps.SSHService.validateRemote(SSHService.groovy:67) at org.jenkinsci.plugins.sshsteps.SSHService.<init>(SSHService.groovy:44) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:274) at org.jenkinsci.plugins.sshsteps.SSHService.create(SSHService.groovy:49) at org.jenkinsci.plugins.sshsteps.util.SSHMasterToSlaveCallable.createService(SSHMasterToSlaveCallable.java:38) at org.jenkinsci.plugins.sshsteps.util.SSHMasterToSlaveCallable.call(SSHMasterToSlaveCallable.java:31) at hudson.remoting.LocalChannel.call(LocalChannel.java:47) at org.jenkinsci.plugins.sshsteps.steps.CommandStep$Execution.run(CommandStep.java:72) at org.jenkinsci.plugins.sshsteps.util.SSHStepExecution.lambda$start$0(SSHStepExecution.java:84) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Finished: FAILURE 

       

      Jenkinsfile:

      @Library('Jenkins-SL')_
      
      def remote = [:]
      remote.name = "petheart-staging"
      remote.host = "172.17.19.X"
      remote.gateway = "167.235.2.X"
      remote.allowAnyHosts = true
      
      node {
          withCredentials([sshUserPrivateKey(credentialsId: 'JENKINS_SSH_ACCESS', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'userName')]) {
              remote.user = userName
              remote.identityFile = identity
              stage("PHP Artisan Remote Migrations") {
                  sshCommand remote: remote, command: 'php artisan migrate --force --no-interaction'
              }
          }
      }
       

            nrayapati Naresh Rayapati
            florinmarian Florin - Marian Hazi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: