2016-12-23 5 views
0

Я пытаюсь настроить Jenkins для клонирования git-репозитория с использованием соответствующего плагина.Ошибка аутентификации Jenkins git при использовании учетных данных

Однако я не знаю, почему, но он не работает при попытке аутентификации.

Я попытался определить полномочия через Дженкинс, но он не:

Building in workspace /var/lib/jenkins/workspace/CLARA 
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> /usr/bin/git config remote.origin.url https://hola.int/git-repos/ # timeout=10 
Fetching upstream changes from https://hola.int/git-repos/ 
> /usr/bin/git --version # timeout=10 
using GIT_ASKPASS to set credentials Access to CLARA 
Setting http proxy: proxy.es:80 
> /usr/bin/git fetch --tags --progress https://hola.int/git-repos/ +refs/heads/*:refs/remotes/origin/* 
ERROR: Error fetching remote repo 'origin' 
hudson.plugins.git.GitException: Failed to fetch from https://hola.int/git-repos/ 
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803) 
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063) 
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094) 
at hudson.scm.SCM.checkout(SCM.java:495) 
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278) 
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) 
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) 
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) 
at hudson.model.Run.execute(Run.java:1729) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
at hudson.model.ResourceController.execute(ResourceController.java:98) 
at hudson.model.Executor.run(Executor.java:404) 
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://hola.int/git-repos/ +refs/heads/*:refs/remotes/origin/*" returned status code 128: 
stdout: 
stderr: fatal: Authentication failed for 'https://hola.int/git-repos/' 

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315) 
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:801) 
... 11 more 

Я также пытался оставить пустые учетные данные и включают в себя пользователь/пасс в пути мерзавца в хранилище, но он также не :

Building in workspace /var/lib/jenkins/workspace/CLARA 
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> /usr/bin/git config remote.origin.url https://XXXX:[email protected]/git-repos/ # timeout=10 
Fetching upstream changes from https://[email protected]/git-repos/ 
> /usr/bin/git --version # timeout=10 
Setting http proxy: proxy.es:80 
> /usr/bin/git fetch --tags --progress https://[email protected]/git-repos/ +refs/heads/*:refs/remotes/origin/* 
ERROR: Error fetching remote repo 'origin' 
hudson.plugins.git.GitException: Failed to fetch from https://[email protected]/git-repos/ 
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803) 
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063) 
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094) 
at hudson.scm.SCM.checkout(SCM.java:495) 
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278) 
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) 
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) 
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) 
at hudson.model.Run.execute(Run.java:1729) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
at hudson.model.ResourceController.execute(ResourceController.java:98) 
at hudson.model.Executor.run(Executor.java:404) 
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://[email protected]/git-repos/ +refs/heads/*:refs/remotes/origin/*" returned status code 128: 
stdout: 
stderr: fatal: Authentication failed for 'https://[email protected]/git-repos/' 

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315) 
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:801) 
... 11 more 

Однако, если я пытаюсь клонировать хранилище в узле Дженкинса, он работает. Просто делайте то, что делает Дженкинс:

git config --global http.proxy http://proxy.es:80 
/usr/bin/git fetch --tags --progress https://[email protected]/git-repos/ +refs/heads/*:refs/remotes/origin/* 

спрашивайте у меня пароль и продолжайте без сбоев.

Использование проход также работает:

git config --global http.proxy http://proxy.es:80 
/usr/bin/git fetch --tags --progress https://XXXX:[email protected]/git-repos/ +refs/heads/*:refs/remotes/origin/* 

Мой чистый под прокси. Но я уже включил детали прокси в Jenkins, и плагин git должен использовать его.

Версия Jenkins - 2.37 и плагин git 3.0.1.

Сборка выполняется внутри контейнера Docker с использованием плагина Docker. Но я думаю, что это не важно. У меня такая же проблема без Докера. То, что я проверил ранее, было создание контейнера в изображении докера, чтобы точно воспроизвести то, что делает Дженкинс.

Спасибо за любую помощь, которую вы можете мне предоставить.

+0

Сложно отлаживать. Но, возможно, вам нужно указать https_proxy = http: //proxy.es: 80 тоже для вашего git-плагина, а не только для http? Хотя ошибка неудачной аутентификации является странной. – lvthillo

+0

Спасибо, но я не знаю, как указать параметры прокси для git-плагина. – cardogar

+0

Сообщение закрыто, поскольку это было проблемой с доверенным лицом компании OPs. –

ответ

1

Если ваши учетные данные jenkin и git-учетные записи одинаковы, тогда это не удастся. Измените свои учетные данные jenkins, это сработает.

+0

Спасибо за ваше предложение. Я не совсем понимаю, что вы имеете в виду. При использовании учетных данных git с помощью 'https: // XXXX: YYYY @ hola.int/git-repos /' Я отключу учетные данные jenkins (я выбираю вариант -none-) в конфигурации задания. Я не могу установить глобальные переменные конфигурации git в машине jenkins. Если я делаю это, это работает, так как он игнорирует конфигурацию jenkins (я ее протестировал), но я не могу «жестко закодировать» это в моем изображении Docker. – cardogar