[JIRA] (JENKINS-39865) Multibranch: Git credentials are not used on checkout scm

11 views
Skip to first unread message

daniel.geissler@salt-solutions.de (JIRA)

unread,
Nov 18, 2016, 7:54:01 AM11/18/16
to jenkinsc...@googlegroups.com
Daniel Geißler created an issue
 
Jenkins / Bug JENKINS-39865
Multibranch: Git credentials are not used on checkout scm
Issue Type: Bug Bug
Assignee: Matthew DeTullio
Components: multi-branch-project-plugin
Created: 2016/Nov/18 12:53 PM
Environment: Jenkins 2.19.3
Pipeline: Multibranch 2.9.2
Priority: Major Major
Reporter: Daniel Geißler

I've configured global credentials for SSH username and private key.

They are used by a multibranch pipeline project to access a git repository.
Indexing is working fine and the branch job is created.

Started
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to ...Playground.git
 > git config remote.origin.url ...Playground.git # timeout=10
Fetching & pruning origin...
Fetching upstream changes from origin
 > git --version # timeout=10
using GIT_SSH to set credentials Jenkins Private Key for Git Access
 > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune
...

But the Branch Job itself is unable to access the repository:

Branch indexing
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to ..Playground.git
 > git config remote.origin.url ..Playground.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials Jenkins Private Key for Git Access
 > git fetch -t ..Playground.git +refs/heads/*:refs/remotes/origin/* # timeout=10
Seen branch in repository origin/Test_Branch
Seen branch in repository origin/development
...
Seen 8 remote branches
Cloning the remote Git repository
Cloning repository ..Playground.git
 > git init /var/lib/jenkins/workspace/playground_development-FVZJG3FUP3I5HAUYK5DAE3QJUATGZYBRDFHXJH5R5ZSZMILHQWWQ@script # timeout=10
Fetching upstream changes from ..Playground.git
 > git --version # timeout=10
using GIT_SSH to set credentials Jenkins Private Key for Git Access
 > git fetch --tags --progress ..Playground.git +refs/heads/*:refs/remotes/origin/*
 > git config remote.origin.url ..Playground.git # timeout=10
 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url ..Playground.git # timeout=10
Fetching upstream changes from ..Playground.git
using GIT_SSH to set credentials Jenkins Private Key for Git Access
 > git fetch --tags --progress ..Playground.git +refs/heads/*:refs/remotes/origin/*
Checking out Revision 41d170c75b56439500ee5e661a5c6f8787196427 (development)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 41d170c75b56439500ee5e661a5c6f8787196427
First time build. Skipping changelog.
[Pipeline] node
Running on master in /var/lib/jenkins/workspace/playground_development-FVZJG3FUP3I5HAUYK5DAE3QJUATGZYBRDFHXJH5R5ZSZMILHQWWQ
[Pipeline] {
[Pipeline] stage
[Pipeline] { (preparation)
[Pipeline] git
Cloning the remote Git repository
Cloning repository ..Playground.git
 > git init /var/lib/jenkins/workspace/playground_development-FVZJG3FUP3I5HAUYK5DAE3QJUATGZYBRDFHXJH5R5ZSZMILHQWWQ # timeout=10
Fetching upstream changes from ..Playground.git
 > git --version # timeout=10
 > git fetch --tags --progress ..Playground.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress ..Playground.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1042)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1082)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)

The current workaround is to put the keyfile in jenkins users ~/.ssh directory, but as of the documentation i think this must not be necessary.

scm
Represents the SCM configuration in a multibranch project build...

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

daniel.geissler@salt-solutions.de (JIRA)

unread,
Nov 18, 2016, 8:00:01 AM11/18/16
to jenkinsc...@googlegroups.com
Daniel Geißler closed an issue as Not A Defect
 

Sorry, it was just a old Jenkinsfile with wrong credential Id and not using the "checkout scm" step.

Change By: Daniel Geißler
Status: Open Closed
Resolution: Not A Defect
Reply all
Reply to author
Forward
0 new messages