2016-05-06 4 views
0

Я пытаюсь построить проект Jenkins из репозитория Bitbucket. Эти сборки должны выполняться при каждом нажатии. Дженкинс настроен на моем локальном компьютере.Bitbucket Hook не работает для проекта Jenkins

Я настроил переадресацию портов, поэтому Jenkins можно использовать с моего внешнего IP-адреса.

Я установить Bitbucket плагин для Jenkins: https://wiki.jenkins-ci.org/display/JENKINS/BitBucket+Plugin

Я настроил мой проект со следующими параметрами: SCM: Git:

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 * * * * 

Битбакет: отправился в проект - веб-камеры.

Title: Jenkins 
Url: http://myExternalIp:PortforwardingPort/bitbucket-hook/ 
Active Checked 
Triggers: Repository push checked 

Когда я нажимаю на эту Repository я могу видеть, что я получаю 200 Response (к успеху в пост 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:[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 

Когда я построить проект вручную, я получаю сообщение об ошибке, что имя пользователя и пароль неправы, который является своего рода непоследовательной. Иногда он терпит неудачу с ошибкой выше, а иногда и не получается сказать, что мое имя пользователя/пароль неверно, что я проверил несколько раз.

Я попытался запустить сборку вручную с помощью функции «Запуск триггера удаленно», и он начинает строить. Сборка по-прежнему не работает, пытаясь извлечь из Bitbucket.

Я искал вокруг и обнаружил, что многие люди уже столкнулись с этой проблемой. Однако ответы для меня не работают.

ответ

0

Пара вещей -

  1. Пожалуйста, не используйте опцию сборки Триггеры/Poll SCM. Если вы периодически проводите опрос SCM/Bitbucket с периодическим интервалом, то в чем смысл настройки webhook?
  2. Возможно, вам необходимо дважды проверить регистр букв, которые вы используете для настройки URL-адреса Jenkins/CI в Bitbucket. У меня была аналогичная проблема, и мне удалось ее решить после фиксации дела. URL-адрес имел несколько алфавитов в верхнем регистре, тогда как тот, который я сконфигурировал, не имел этого. Помните, что веб-крючок чувствителен к регистру.