Сбой аутентификации Git на jenkins с hudson после обновления до Мохаве - PullRequest
0 голосов
/ 17 апреля 2019

Наш CI (Jenkins) ранее работал на High Sierra, используя стандартную конфигурацию master-slave, где master предоставляет slave учетные данные ssh во время сборки. После обновления до mojave все наши сборки терпят неудачу с этими сообщениями:

21:29:33 Fetching changes from the remote Git repository
21:29:33  > git config remote.origin.url git@github.com:myrepo/ios.git # timeout=10
21:29:33 Pruning obsolete local branches
21:29:34 Fetching upstream changes from git@github.myrepo/ios.git
21:29:34  > git --version # timeout=10
21:29:34 using GIT_SSH to set credentials For use with GitHub
21:29:34  > git -c core.askpass=true fetch --tags --progress git@github.com:myrepo/ios.git +refs/heads/master:refs/remotes/origin/master --prune # timeout=30
21:29:34 ERROR: Error fetching remote repo 'origin'
21:29:34 hudson.plugins.git.GitException: Failed to fetch from git@github.com:myrepo/ios.git
21:29:34    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:766)
21:29:34    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1022)
21:29:34    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
21:29:34    at hudson.scm.SCM.checkout(SCM.java:485)
21:29:34    at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
21:29:34    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
21:29:34    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
21:29:34    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
21:29:34    at hudson.model.Run.execute(Run.java:1738)
21:29:34    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
21:29:34    at hudson.model.ResourceController.execute(ResourceController.java:98)
21:29:34    at hudson.model.Executor.run(Executor.java:410)
21:29:34 Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@github.com:myrepo/ios.git +refs/heads/master:refs/remotes/origin/master --prune" returned status code 128:
21:29:34 stdout: 
21:29:34 stderr: jenkins@github.com: Permission denied (publickey).
21:29:34 fatal: Could not read from remote repository.
21:29:34 
21:29:34 Please make sure you have the correct access rights
21:29:34 and the repository exists.
21:29:34 
21:29:34    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
21:29:34    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
21:29:34    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
21:29:34    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
21:29:34    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
21:29:34    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
21:29:34    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
21:29:34    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
21:29:34    at hudson.remoting.Request$2.run(Request.java:326)
21:29:34    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
21:29:34    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
21:29:34    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
21:29:34    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
21:29:34    at hudson.remoting.Engine$1$1.run(Engine.java:62)
21:29:34    at java.lang.Thread.run(Thread.java:748)
21:29:34    at ......remote call to App_test_2(Native Method)
21:29:34    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
21:29:34    at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
21:29:34    at hudson.remoting.Channel.call(Channel.java:781)
21:29:34    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
21:29:34    at sun.reflect.GeneratedMethodAccessor414.invoke(Unknown Source)
21:29:34    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
21:29:34    at java.lang.reflect.Method.invoke(Method.java:497)
21:29:34    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
21:29:34    at com.sun.proxy.$Proxy84.execute(Unknown Source)
21:29:34    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:764)
21:29:34    ... 11 more
2

Я подозреваю пользователя jenkins@github.com, потому что ssh-клонирование из github обычно выполняется как git@github.com.

У кого-нибудь есть предложения, как исправить эту ошибку SSH? Любые подробности, которые я могу предоставить?

1 Ответ

0 голосов
/ 18 апреля 2019

На мой вопрос выше наиболее полезно ответила эта ошибка Jenkins JIRA: Неправильное имя пользователя, используемое для git clone с OpenSSH 7.7 .Точная проблема не была той же, но исправление, перечисленное в нижней части , включающее создание нового набора учетных данных на Jenkins Master с именем пользователя, установленным на «git», решило мою проблему.Повторим, исправление состояло в том, чтобы с помощью графического интерфейса Jenkins установить новый набор учетных данных ssh с новым закрытым ключом, сгенерированным как описано в документации Github , и добавить этот закрытый ключ в Jenkins, убедившись, что изменилиимя пользователя по умолчанию для "jenkins" - "git".

...