-
Bug
-
Resolution: Not A Defect
-
Trivial
-
Jenkins casc 1.44
github:1.30.0
running in docker with jenkins/jenkins:2.249.2-lts-alpine
A multibranch pipeline fails to checkout a submodule repo from an on-prem github using user/password credentials.
The pipeline succeeds first getting all branches from the repo (using the username/password) but then next fail to pull that specific branch.
Tried with a username/ssh key and git:// scheme, tried also with a https://username:password@ scheme. Each has the same failure.
It's as if the username/password is forgotten after its first time use to fetch branch information.
The error goes like this (sensitive parts are replaced):
Branch indexing > git rev-parse --is-inside-work-tree # timeout=10 Setting origin to https://github.private.com/Dep/project.git > git config remote.origin.url https://github.private.com/Dep/project.git # timeout=10 Fetching origin... Fetching upstream changes from origin > git --version # timeout=10 > git --version # 'git version 2.26.2' > git config --get remote.origin.url # timeout=10 using GIT_ASKPASS to set credentials Access github repo > git fetch --tags --force --progress -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10 Seen branch in repository origin/Dep/add_submodule ... cut some lines here ... Seen 5 remote branches Obtained Jenkinsfile from 463f3d60c604e489e847e20f880942f4cdf68b0b Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] library Loading library jenkins-pipeline-test@Dep/add_submodule Attempting to resolve Dep/add_submodule from remote references... > git --version # timeout=10 > git --version # 'git version 2.26.2' > git ls-remote -- https://github.private.com/Dep/project # timeout=10 ERROR: Checkout failed hudson.plugins.git.GitException: Command "git ls-remote -- https://github.private.com/Dep/project" returned status code 128: stdout: stderr: remote: Invalid username or password. fatal: Authentication failed for 'https://github.private.com/Dep/project/' at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1951) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1942) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getRemoteReferences(CliGitAPIImpl.java:3381) at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:838) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:636) at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.lambda$retrieve$0(SCMSourceRetriever.java:92) at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrySCMOperation(SCMSourceRetriever.java:107) at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:92) at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:157) at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:205) at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:154) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:367) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) [Pipeline] End of Pipeline ERROR: Maximum checkout retry attempts reached, aborting Finished: FAILURE
Is the submodule defined to use the same protocol and same credentials as the parent repository?
Authenticated submodule checkout requires that the submodule must be accessed using the same protocol and same credentials as the parent repository. If the original repository is fetched with https (as it appears in your case), then the submodule reference in that branch of the original repository must refer to the submodule using https protocol, not using ssh protocol.
Is the checkout step defined to use the parent credentials ( parentCredentials: true ) when performing the submodule checkout?
In my acceptance test job, I see the following definition of the checkout step:
The command line git version 2.26.2 has full support for submodules. While investigating to see if there is an issue here, I ran an acceptance test job on agents with Git 2.26.2 (FreeBSD and OpenBSD in my test cases). Those jobs were all successful at submodule checkout.
If it helps, you're welcome to refer to the public version of my acceptance test job for details that I know are working in my acceptance test environment. I have a similar job that includes credentials and uses https to access a private GitHub repository.