2016-05-06 74 views
0

我試圖從Bitbucket倉庫中構建一個Jenkins項目。這些構建應該在每次推動時執行。詹金斯在我的本地計算機上設置。Jenkins項目的Bitbucket鉤子失敗

我設置了端口轉發,因此Jenkins可以從我的外部IP地址使用。

我已經安裝到位桶插件詹金斯:https://wiki.jenkins-ci.org/display/JENKINS/BitBucket+Plugin

我配置了我以下設置項目: SCM:混帳:

Repository URL: https://$BitbucketUserName:[email protected]/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響應(成功發佈到詹金斯)。

到位桶推日誌顯示以下異常:

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:[email protected]/company/projectname.git # timeout=10 
Fetching upstream changes from https://[email protected]/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://[email protected]/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://[email protected]/company/project.git 
hudson.util.IOException2: hudson.plugins.git.GitException: Failed to fetch from https://[email protected]/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://[email protected]/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://[email protected]/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 

當我手工打造的項目中,我得到了錯誤的用戶名和密碼是錯誤的這是一種矛盾。有時它會因上面的錯誤而失敗,有時會失敗,說我的用戶名/密碼錯誤,我檢查過幾次。

我試着用「Trigger build remote」檢查手動開始構建,並開始構建。嘗試從Bitbucket獲取時,構建仍然失敗。

我周圍搜索,發現很多人已經有這個問題。但是,答案不適用於我。

回答

0

幾件事情 -

  1. 請不要使用觸發器構建/ SCM投票選項。如果您定期輪詢SCM/Bitbucket,配置webhook有什麼意義?
  2. 您可能希望仔細檢查您用於在Bitbucket中配置Jenkins/CI URL的字母大小寫。我遇到了類似的問題,並在解決案件後設法解決問題。該URL有一些大寫的字母,而我配置的那個沒有這樣的。記住Web掛鉤區分大小寫。