On Thu, May 16, 2019 at 7:13 AM gbon <gabriele.bone...@gmail.com> wrote:

> 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.
>
>
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-users+unsubscr...@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
> <https://groups.google.com/d/msgid/jenkinsci-users/0f7c8c1c-c1a8-4495-8be5-d00b5c5997ff%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Thanks!
Mark Waite

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFqxh-mHCxnLK_Rs-3WgXVkZWR8urCnPQ3k52pVDyzLRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to