Ошибка при проверке репозитория git с субмодулями - PullRequest
0 голосов
/ 27 января 2019

При развертывании моих тестов на экземпляре Jenkins я заметил, что некоторые подмодули не могут быть инициализированы.

В Jenkins я установил флажок для Use credentials from default remote of parent repository, что позволило инициализировать первый подмодуль.К сожалению, что бы я ни делал, остальное не работает.

 > git remote # timeout=10
 > git submodule init # timeout=10
 > git submodule sync # timeout=10
 > git config --get remote.origin.url # timeout=10
 > git submodule init # timeout=10
 > git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10
 > git config --get submodule.sub1.url # timeout=10
 > git remote # timeout=10
 > git config --get remote.origin.url # timeout=10
 > git config -f .gitmodules --get submodule.sub1.path # timeout=10
using GIT_SSH to set credentials 
 > git submodule update --init --recursive sub1
 > git config --get submodule.sub2.url # timeout=10
 > git remote # timeout=10
 > git config --get remote.origin.url # timeout=10
 > git config -f .gitmodules --get submodule.sub2.path # timeout=10
using GIT_SSH to set credentials 
 > git submodule update --init --recursive sub2
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
hudson.plugins.git.GitException: Command "git submodule update --init --recursive sub2" returned status code 1:
stdout: 
stderr: Cloning into '/var/jenkins_home/workspace/develop/sub2'...
repository does not exist.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@bitbucket.org:xxxx/xxx.git/sub2' into submodule path '/var/jenkins_home/workspace/develop/sub2' failed
Failed to clone 'sub2'. Retry scheduled
Cloning into '/var/jenkins_home/workspace/develop/sub2'...
repository does not exist.
fatal: Could not read from remote repository.

Я также проверил, что в .git/config у меня есть правильные пути к другим репозиториям в bitbucket.

1 Ответ

0 голосов
/ 27 января 2019

Ошибка не имеет ничего общего с Дженкинсом или битбакетом, но имеет неверную конфигурацию git..git/config не отслеживается, но .gitmodules есть.

Путь git@bitbucket.org:xxxx/xxx.git/sub2 должен был заставить меня заметить фактическую ошибку, которая была в .gitmodules:

[submodule "sub1"]
    path = sub1
    url = git@bitbucket.org:xxxx/sub1.git
[submodule "sub2"]
    path = sub2
    url = ./sub2

Этоработал локально из-за другой локальной конфигурации, которая не отслеживается git.В основном в .gitmodules это должны быть только адреса.

Я допустил ошибку при сборке репозитория и использовании git submodule add sub2 в локальном клоне вместо полной проверки.

...