[JIRA] (JENKINS-38092) workflow-multibranch plugin doesn't use credentials when indexing the branches

20 views
Skip to first unread message

john_stephenson_uk@hotmail.com (JIRA)

unread,
Sep 9, 2016, 5:33:02 AM9/9/16
to jenkinsc...@googlegroups.com
John Stephenson created an issue
 
Jenkins / Bug JENKINS-38092
workflow-multibranch plugin doesn't use credentials when indexing the branches
Issue Type: Bug Bug
Assignee: Jesse Glick
Components: workflow-multibranch-plugin
Created: 2016/Sep/09 9:32 AM
Environment: Jenkins is hosted in a docker container defined below:

FROM jenkins:2.7.3
USER root
RUN apt-get update && \
    apt-get install -y ruby ruby-dev && \
    apt-get -y install curl && \
    curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
    apt-get install -y nodejs && \
    apt-get install -y git && \
    npm install -g jspm && \
    npm install -g gulp-cli && \
    apt-get install -y build-essential && \
    /usr/local/bin/install-plugins.sh docker-slaves github-branch-source:1.8 \
disk-usage nested-view saferestart greenballs build-flow build-monitor build-timeout build-name-setter \
cucumber-testresult git git-client hipchat Exclusion embeddable-build-status extended-read-permission \
      workflow-aggregator bitbucket
Labels: pipeline git plugins
Priority: Major Major
Reporter: John Stephenson

When using the mutlibranch indexing I can't connect to bitbucket due to the credentials not being used correctly. I've setup credentials for the repository and can create a single branch project that connects and pulls correctly (see the end of this description). The output from the multibranch indexing job is below.

> git rev-parse --is-inside-work-tree # timeout=10
Setting origin to https://bitbucket.org/XXXX/xxxxx.git
> git config remote.origin.url https://bitbucket.org/XXXX/xxxxx.git # timeout=10
Fetching & pruning origin...
Fetching upstream changes from origin
> git --version # timeout=10
> git -c core.askpass=true fetch --tags --progress origin +refs/heads/:refs/remotes/origin/ --prune
FATAL: Failed to recompute children of test
hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress origin +refs/heads/:refs/remotes/origin/ --prune" returned status code 128:
stdout:
stderr: remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
fatal: Authentication failed for 'https://bitbucket.org/XXXX/xxxxx.git/'

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1740)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1476)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:293)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:148)
at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:294)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:157)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:122)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE

----------------

As mentioned, if I run a (different) single branch project job against the same repo on the same machine I get:

ln -s builds/lastSuccessfulBuild /var/jenkins_home/jobs/bosh/lastSuccessful failed: 71 Protocol error
ln -s builds/lastStableBuild /var/jenkins_home/jobs/bosh/lastStable failed: 71 Protocol error
Cloning the remote Git repository
Cloning repository https://bitbucket.org/XXXX/xxxxx.git
> git init /var/jenkins_home/workspace/bosh@script # timeout=10
Fetching upstream changes from https://bitbucket.org/XXXX/xxxxx.git
> git --version # timeout=10
*using .gitcredentials to set credentials
> git config --local credential.username XXXX# timeout=10
> git config --local credential.helper store --file=/tmp/git7209450783850968846.credentials # timeout=10*
> git -c core.askpass=true fetch --tags --progress https://bitbucket.org/XXXX/xxxxx.git +refs/heads/:refs/remotes/origin/
> git config --local --remove-section credential # timeout=10
> git config remote.origin.url https://bitbucket.org/XXXX/xxxxx.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10
> git config remote.origin.url https://bitbucket.org/XXXX/xxxxx.git # timeout=10
Fetching upstream changes from https://bitbucket.org/XXXX/xxxxx.git

..... blah blah blah and it completes successfully. Note the use of .gitcredentials which is missing from the multibranch indexing builds.

-------------

I could just run the steps manually on the machine but that's not great and feels like it should be unnecessary. Any ideas?

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

john_stephenson_uk@hotmail.com (JIRA)

unread,
Sep 9, 2016, 5:34:03 AM9/9/16
to jenkinsc...@googlegroups.com
John Stephenson updated an issue
Change By: John Stephenson
When using the mutlibranch indexing I can't connect to bitbucket due to the credentials not being used correctly. I've setup credentials for the repository and can create a single branch project that connects and pulls correctly (see the end of this description). The output from the multibranch indexing job is below.

> git rev-parse --is-inside-work-tree # timeout=10
Setting origin to https://bitbucket.org/XXXX/xxxxx.git
> git config remote.origin.url https://bitbucket.org/XXXX/xxxxx.git # timeout=10
Fetching & pruning origin...
Fetching upstream changes from origin
> git --version # timeout=10
> git -c core.askpass=true fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune

FATAL: Failed to recompute children of test
hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune" returned status code 128:

stdout:
stderr: remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
fatal: Authentication failed for 'https://bitbucket.org/XXXX/xxxxx.git/'

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1740)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1476)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:293)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:148)
at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:294)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:157)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:122)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE


----------------

As mentioned, if I run a (different) single branch project job against the same repo on the same machine I get:

{{ ln -s builds/lastSuccessfulBuild /var/jenkins_home/jobs/bosh/lastSuccessful failed: 71 Protocol error

ln -s builds/lastStableBuild /var/jenkins_home/jobs/bosh/lastStable failed: 71 Protocol error
Cloning the remote Git repository
Cloning repository https://bitbucket.org/XXXX/xxxxx.git
> git init /var/jenkins_home/workspace/bosh@script # timeout=10
Fetching upstream changes from https://bitbucket.org/XXXX/xxxxx.git
> git --version # timeout=10
* * using .gitcredentials to set credentials

> git config --local credential.username XXXX# timeout=10
> git config --local credential.helper store --file=/tmp/git7209450783850968846.credentials # timeout=10* *
> git -c core.askpass=true fetch --tags --progress https://bitbucket.org/XXXX/xxxxx.git +refs/heads/*:refs/remotes/origin/*

> git config --local --remove-section credential # timeout=10
> git config remote.origin.url https://bitbucket.org/XXXX/xxxxx.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10

> git config remote.origin.url https://bitbucket.org/XXXX/xxxxx.git # timeout=10
Fetching upstream changes from https://bitbucket.org/XXXX/xxxxx.git
}}

..... blah blah blah and it completes successfully. Note the use of .gitcredentials which is missing from the multibranch indexing builds.

-------------

I could just run the steps manually on the machine but that's not great and feels like it should be unnecessary. Any ideas?

john_stephenson_uk@hotmail.com (JIRA)

unread,
Sep 9, 2016, 5:34:04 AM9/9/16
to jenkinsc...@googlegroups.com
ln -s builds/lastSuccessfulBuild /var/jenkins_home/jobs/bosh/lastSuccessful failed: 71 Protocol error
* * using .gitcredentials to set credentials *
> git config --local credential.username XXXX# timeout=10
> git config --local credential.helper store --file=/tmp/git7209450783850968846.credentials # timeout=10
**
> git -c core.askpass=true fetch --tags --progress https://bitbucket.org/XXXX/xxxxx.git +refs/heads/*:refs/remotes/origin/*
> git config --local --remove-section credential # timeout=10
> git config remote.origin.url https://bitbucket.org/XXXX/xxxxx.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://bitbucket.org/XXXX/xxxxx.git # timeout=10
Fetching upstream changes from https://bitbucket.org/XXXX/xxxxx.git
}}

..... blah blah blah and it completes successfully. Note the use of .gitcredentials which is missing from the multibranch indexing builds.

-------------

I could just run the steps manually on the machine but that's not great and feels like it should be unnecessary. Any ideas?

jglick@cloudbees.com (JIRA)

unread,
Sep 23, 2016, 4:11:05 PM9/23/16
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
Change By: Jesse Glick
Component/s: bitbucket-branch-source-plugin
Component/s: workflow-multibranch-plugin

jglick@cloudbees.com (JIRA)

unread,
Sep 23, 2016, 4:11:07 PM9/23/16
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
Change By: Jesse Glick
Component/s: git-plugin
Component/s: bitbucket-branch-source-plugin

jglick@cloudbees.com (JIRA)

unread,
Sep 23, 2016, 4:12:01 PM9/23/16
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Sep 23, 2016, 4:12:02 PM9/23/16
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-38092
 
Re: workflow-multibranch plugin doesn't use credentials when indexing the branches

Not sure what the issue is, but anyway you probably want to install the BitBucket Branch Source plugin and use that instead.

jglick@cloudbees.com (JIRA)

unread,
Oct 27, 2016, 11:13:03 AM10/27/16
to jenkinsc...@googlegroups.com
Jesse Glick resolved as Incomplete
 
Change By: Jesse Glick
Status: Open Resolved
Resolution: Incomplete

john_stephenson_uk@hotmail.com (JIRA)

unread,
Oct 27, 2016, 11:37:01 AM10/27/16
to jenkinsc...@googlegroups.com
John Stephenson commented on Bug JENKINS-38092
 
Re: workflow-multibranch plugin doesn't use credentials when indexing the branches

I have done just that, with some but not complete success (not this plugin's fault). If this is a known problem perhaps some information could be added to the wiki page to let other know not to use this plugin in certain circumstances?

As an aside I don't think the resolution should be 'Incomplete'. I'm happy with 'Won't fix' etc but to say Incomplete suggests that there's not enough information to fix the defect (you haven't indicated that's the case), or something else.

Please don't take my comment the wrong way. I appreciate the time you have spent on this, I'm just trying to get myself and others to a more 'happy place' .

jglick@cloudbees.com (JIRA)

unread,
Oct 28, 2016, 1:25:01 PM10/28/16
to jenkinsc...@googlegroups.com

Incomplete suggests that there's not enough information to fix the defect

Exactly. In general for problems involving an external service, which are unlikely to be easily reproducible in a self-contained environment, you would need to track down the root problem yourself.

I have done just that

Not in the stack trace in the issue description—that is showing the plain Git branch source. You want to install the aforementioned plugin and use its branch source instead. You can use the plain Git branch source with BitBucket, but the performance and features will be inferior.

If this is a known problem

There is no bug in this area that I am aware of.

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 9:31:31 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Fixed
 
Change By: Mark Waite
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages