有人可以帮我吗?
我在Jenkins中使用容器docker的错误:
Started by user Desenvolvimento Flash
Building in workspace /var/jenkins_home/workspace/FlashCTe
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url
ssh://ricardo_fernando@177.154.146.106:22/var/git/FlashCTe.git # timeout=10
Fetching upstream changes from ssh://ricardo_fernando@177.154.146.106:22/var/git/FlashCTe.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress ssh://ricardo_fernando@177.154.146.106:22/var/git/FlashCTe.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from ssh://ricardo_fernando@177.154.146.106:22/var/git/FlashCTe.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
at hudson.scm.SCM.checkout(SCM.java:504)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1798)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress ssh://usename@xxx.xxx.xxx.xxx:22/var/git/FlashCTe.git +refs/heads/*:refs/remotes/origin/*" returned status code 143:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2016)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1735)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:420)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:886)
... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE
容器日志:
Aug 25, 2018 9:31:22 PM org.jenkinsci.remoting.util.AnonymousClassWarnings warn
WARNING: Attempt to (de-)serialize anonymous class com.cloudbees.plugins.credentials.CredentialsScope$1 in file:/var/jenkins_home/plugins/credentials/WEB-INF/lib/credentials.jar; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
Password: Password: Password:
答案 0 :(得分:-1)
我有同样的问题。我使用ssh凭证(带有密码)将jenkins与我的git repo连接。问题是我已经用-it标志启动了docker容器。
我使用以下命令运行了Docker容器:
docker run -dit --name nameOfYourContainer --user $(id -u) -p 8080:8080 -v /tmp/jenkins_data:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -v "$HOME":/home jenkinsci/blueocean
问题来自-it标志,它使Jenkins认为它是从终端运行的,并开始要求输入密码短语,而不是使用Credentials设置中提供的密码短语。所以我删除了这个标志,只使用
docker run -d --name ...
要解决您的问题,运行以下命令显示容器提供的日志可能会很有用:
docker logs --details nameOfYourContainer
这是使我指向正确方向的命令,这是我找到解决方案的链接: