flaschbier
flaschbier

Reputation: 4177

Jenkins Git Plugin fails when job name contains "plink"?

For some reason, I am using complex job names in Jenkins and parse some job parameters right from the job name. While the job names tend to become a bit lengthy, it used to work great. All jobs fetch a repo with some scripts to be executed via Jenkins Git Plugin from GitHub. A private key is used which is stored as Credentials in Jenkins.

The Jenkins instance is v2.7.4, running on Linux (so PuTTY's plink is far away), the Git Plugin is v3.3.0, and git is v1.7.1. I am not allowed to upgrade or downgrade.

However, exactly when the name of the job contains the word plink (case insensitive), the job will fail like so:

> git fetch --tags --progress git@github.___/___.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@github.___/___.git
   at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:809)
   ...
   at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@github.___/___.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: getaddrinfo: atch: Name or service not known
ssh: connect to host github.___ port 22: Success
fatal: The remote end hung up unexpectedly

Unfortunately, the job names contain the name part of an email address each. Only recently we have a developer with the string plink in their name and and email and so their job constantly fails. I cannot rework the name parsing thing at this point in time for effort reasons, so the question is:

Given I need the string plink in the job name, and also the git fetch with ssh key, how can I work around this behaviour?

Upvotes: 2

Views: 1137

Answers (1)

Mark Waite
Mark Waite

Reputation: 1500

Command line git 1.7.1 (as included with CentOS 6) is not supported with the Jenkins git plugin. There are cases where it is known to work, but it is officially unsupported. This is one of the cases where it does not work.

Command line git 1.8 (included by default in CentOS 7, Red Hat Enterprise Linux 7, Oracle Linux 7, and Scientific Linux 7), has the same issue. See JENKINS-62534 for more details.

Alternatives include:

  • Enable JGit in your Jenkins instance and configure the job to use JGit instead of CLI git
  • Install a newer version of command line git. Command line git 2.7 and later are known to not have the issue. Command line git 2.0 and later probably don't have the issue
  • Clone the repository with http or https instead of ssh protocol

Upvotes: 1

Related Questions