Checkout of Git repository with submodules failed in Bamboo
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
要約
Checkout for repositories with submodules fails.
診断
atlassian-bamboo.log
に次のメッセージが表示される。
'C:\Program Files (x86)\Git\bin\git.exe' submodule update --init --recursive
Cloning into '<submodule-path>'...
fatal: Authentication failed
Clone of '<repository-url>' into submodule path '<submodule-path>' failed
原因
Bamboo support for submodules is limited in older versions. In particular, Bamboo doesn't provide credentials for submodule operations and the credentials must be available to Git via the environment on the agent.
ソリューション
Submodules accessed via SSH
Upgrade to Bamboo 8.1.1 which provides submodule authentication support:
Enable the option at Repository Configuration >> Advanced Options >> SSH key applies to submodules
回避策
Submodules accessed via SSH
- Configure passwordless SSH keys for the account used by Bamboo: Bitbucket Server and Cloud Repositories With Git Submodules
Submodules accessed via HTTP/HTTPS
Windows
Option 1: Recommended
Use Git Credential Manager. Make sure GCM_INTERACTIVE is set to Never.
オプション 2:
This workaround involves storing credentials in plaintext in a file and may not be suitable for all environments depending on security requirements.
Create
_netrc
filemachine <hostname> login <login> password <password>
ie.
machine bitbucket.org login kbrazulewicz password ******
- Copy
_netrc
to the home directory of account used by BambooC:\WINDOWS\system32\config\systemprofile
for instances running as system service- user's home directory for instances run from console
- Repeat the copy for all remote agents that are supposed to checkout this repository
- If Bamboo is run as service (using Local System Account) you should make sure that
HOME
environment variable is set- Go to Administration / System information, scroll down to section Environment Variables and check if
HOME
variable is defined If not, create a no-repository plan with a script task that would run
setx HOME C:\WINDOWS\system32\config\systemprofile
- Run this plan on local agent
- Run this plan on all remote agents that are supposed to checkout this repository
- Reboot Bamboo server (it is not enough to restart service)
- Reboot all remote agents that are supposed to checkout this repository
- Go to Administration / System information, scroll down to section Environment Variables and verify if
HOME
variable is defined
- Go to Administration / System information, scroll down to section Environment Variables and check if
Now Bamboo should be able to successfully checkout repository and initialize submodules