node parameter makes pipeline fail even if it's unused

30 views
Skip to first unread message

gbon

unread,
May 16, 2019, 10:13:07 AM5/16/19
to Jenkins Users
Hi All, 
Asking for advice on this weird behavior:

I have a (declarative) pipeline that works perfectly fine and selects the agent like so 

pipeline {
  agent
{
    node
{
      label
"SOME_LABEL"
   
}
 
}
 
...
}

If I edit the pipeline configuration to add a parameter of type Node ( which I'm still not using in the pipeline! )  the pipeline fails immediately with the following error

Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress g...@my-super-secret-gitlab-repository.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Could not create directory '/export/homes/my_user/.ssh'.
Host key verification failed.
fatal: Could not read from remote repository.


That I think has nothing to do with git since it works perfectly fine and the label is still hardcoded.
Seems like the job isn't correctly dispatched or something but I can't figure out what's happening.

Thanks!

Mark Waite

unread,
May 17, 2019, 8:00:15 AM5/17/19
to Jenkins Users
The declarative Pipeline includes an implicit checkout of the repository on each agent that will be performing a step.  When you add the `node` step, declarative Pipeline attempts to perform a checkout on that node.  If you don't need that default checkout, the `skipDefaultCheckout` option is available.

If you need that default checkout, then you probably need to fix the file system permissions of the /export/homes/my_user/.ssh directory so that the user executing the Pipeline job can read the .$HOME/.ssh directory.  Command line git uses `ssh` to authenticate and clone repositories using the secure shell protocol.

If the `/export/homes/my_user` directory is accessed over NFS, then you may also need to assure that the agent process is not running as root. Root access over NFS is usually not allowed.

You could check for those types of conditions in your environment with a Jenkinsfile something like this:

pipeline {
  options {
    skipDefaultCheckout()
  }
  agent {
    node {
      label "!windows"
    }
  }
  stages {
    stage('Report username') {
      steps {
        sh 'id'
      }
    }
  }
}
 

 
Thanks!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0f7c8c1c-c1a8-4495-8be5-d00b5c5997ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

Mark Waite

unread,
May 17, 2019, 8:02:45 AM5/17/19
to Jenkins Users
I failed to mention that performing git operations over NFS is much slower than performance those operations with a local file system.  I'd generally recommend that file systems on static agents should be locally attached file systems rather than network file systems if possible.
--
Thanks!
Mark Waite
Reply all
Reply to author
Forward
0 new messages