-
Bug
-
Resolution: Not A Defect
-
Major
-
None
-
Ubuntu 14.04.5
Jenkins ver. 2.22
I am using Jenkins with docker slaves (same issue with normal slaves)
When the job start on the slave, the initial git repository is pull correctly but when running a build step (shell script) the slave is losing the GIT_SSH information or that information is not used by git anymore.
When the script try to run git command (pull, commit, push), the git command don't have access to the remote repository.
The only workaround for now is to copy the ssh key to the slave (don't want this for security reason)
Log example
Building remotely on docker-d2539c5d3982 (ubuntu1404-php55) in workspace /home/jenkins/workspace/projectName Cloning the remote Git repository Cloning repository git@github.com:companyName/projectName.git > git init /home/jenkins/workspace/projectName # timeout=10 Fetching upstream changes from git@github.com:companyName/projectName.git > git --version # timeout=10 using GIT_SSH to set credentials Jenkins Git key > git fetch --tags --progress git@github.com:companyName/projectName.git +refs/heads/*:refs/remotes/origin/* > git config remote.origin.url git@github.com:companyName/projectName.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 > git config remote.origin.url git@github.com:companyName/projectName.git # timeout=10 Fetching upstream changes from git@github.com:companyName/projectName.git using GIT_SSH to set credentials Jenkins Git key > git fetch --tags --progress git@github.com:companyName/projectName.git +refs/heads/*:refs/remotes/origin/* > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 Checking out Revision abc123 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f abc123 > git rev-list abc123 # timeout=10 [projectName] $ /bin/sh -xe /tmp/hudson9131786677030535329.sh + cd /home/jenkins/workspace/projectName + git clone git@github.com:companyName/projectName.git Cloning into 'projectName'... Permission denied (publickey). fatal: Could not read from remote repository.