【发布时间】:2016-05-06 13:21:13
【问题描述】:
我正在尝试从 Bitbucket 存储库构建 Jenkins 项目。这些构建应该在每次推送时执行。 Jenkins 设置在我的本地计算机上。
我已设置端口转发,以便可以从我的外部 IP 地址使用 Jenkins。
我已经为 Jenkins 安装了 Bitbucket 插件:https://wiki.jenkins-ci.org/display/JENKINS/BitBucket+Plugin
我使用以下设置配置了我的项目: 单片机:Git:
Repository URL: https://$BitbucketUserName:BitbucketPasswort@bitbucket.org/mycompany/projectname.git
Credentials: Bitbucket Username und Pw
Branch Specifier: **master/
构建触发器:
Build when a change is pushed to Bitbucket checked
Poll SCM: */1 * * * *
Bitbucket:进入项目 - Webhooks。
Title: Jenkins
Url: http://myExternalIp:PortforwardingPort/bitbucket-hook/
Active Checked
Triggers: Repository push checked
当我推送到该存储库时,我可以看到我收到了 200 响应(成功发布到 Jenkins)。
Bitbucket 推送日志显示以下异常:
Polling SCM changes on master
Using strategy: Default
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repositories
> git config remote.origin.url https://username:pw@bitbucket.org/company/projectname.git # timeout=10
Fetching upstream changes from https://username@bitbucket.org/company/projectname.git
> git --version # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username username # timeout=10
> git config --local credential.helper store --file=/Users/Shared/Jenkins/tmp/git7517617021208566630.credentials # timeout=10
> git -c core.askpass=true fetch --tags --progress https://username@bitbucket.org/companyname/projectname.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
> git config --local --remove-section credential # timeout=10
FATAL: hudson.plugins.git.GitException: Failed to fetch from https://username@bitbucket.org/company/project.git
hudson.util.IOException2: hudson.plugins.git.GitException: Failed to fetch from https://user@bitbucket.org/company/project.git
at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:573)
at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:381)
at hudson.scm.SCM.poll(SCM.java:398)
at hudson.model.AbstractProject.pollWithWorkspace(AbstractProject.java:1468)
at hudson.model.AbstractProject._poll(AbstractProject.java:1438)
at hudson.model.AbstractProject.poll(AbstractProject.java:1349)
at com.cloudbees.jenkins.plugins.BitBucketTrigger$1.runPolling(BitBucketTrigger.java:62)
at com.cloudbees.jenkins.plugins.BitBucketTrigger$1.run(BitBucketTrigger.java:87)
at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: hudson.plugins.git.GitException: Failed to fetch from https://user@bitbucket.org/company/project.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:701)
at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:571)
... 14 more
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress https://user@bitbucket.org/company/project.git +refs/heads/*:refs/remotes/origin/*" returned status code 143:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808)
... 16 more
Done. Took 45 Minuten
No changes
当我手动构建项目时,我收到用户名和密码错误的错误,这有点不一致。有时它会因上述错误而失败,有时它会说我的用户名/密码错误,我检查了几次。
我尝试使用“远程触发构建”检查手动启动构建,它开始构建。尝试从 Bitbucket 获取时构建仍然失败。
我四处搜索,发现很多人已经遇到过这个问题。但是,答案对我不起作用。
【问题讨论】:
标签: jenkins bitbucket jenkins-plugins portforwarding