Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38092

workflow-multibranch plugin doesn't use credentials when indexing the branches

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin

      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?

            jglick Jesse Glick
            jfstephe John Stephenson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: