Several issues with BitBucket multi-branch pipeline configuration

621 views
Skip to first unread message

Wład Rożkow

unread,
Apr 12, 2016, 5:02:17 AM4/12/16
to Jenkins Users
Hey all, we've recently started to moving our CI/CD to Jenkins and I'm stuck now with several issues.
First, I give you a bit of background:
  1. We're using BitBucket cloud
  2. We're using feature-branches workflow, so we have like 5-10 new branches every day and same amount of PR's
  3. We want to use fancy `pipeline` feature and store build sequence as a code
I got Jekins 2.0-RC-1 installed, configured, and now I'm stuck with following stuff:
  1. BitBucket hooks not working properly. I have checked "setup webhooks automatically" in plugin configuration but Jenkins always respond with 403 
    <p>Problem accessing /bitbucket-scmsource-hook/notify. Reason:
    <pre>    No valid crumb was included in the request</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>
  2. Since I'm setting up very basic workflow, my build command consists of only one `./gradlew clean distTar` comand, but it fails to execute: 
    [Pipeline] sh
    [feature%2Fjenkins-multibranch] Running shell script
    + pwd
    /var/jenkins_home/workspace/portal/portal/feature%2Fjenkins-multibranch
    [Pipeline] sh
    [feature%2Fjenkins-multibranch] Running shell script
    + ./gradlew clean distTar
    /var/jenkins_home/workspace/portal/portal/feature%2Fjenkins-multibranch@tmp/durable-1ae2cf5c/script.sh: 2: /var/jenkins_home/workspace/portal/portal/feature%2Fjenkins-multibranch@tmp/durable-1ae2cf5c/script.sh: ./gradlew: not found
And here is my Jenkinsfile:
node {
    stage
'Build'
    sh 'pwd'
    sh './gradlew clean distTar'
}



I tried several configurations, googled over existing issues, tried to delete/rebuild workspaces etc. etc. but with no luck.

What I want to achieve
  1. Build only newly added/changed branches on push to BitBucket
That's it.

Hope someone help me,
Thanks.

Wład Rożkow

unread,
Apr 12, 2016, 8:24:28 AM4/12/16
to Jenkins Users
Okay, so far my problem was that I not reading docs :)

In Jekinsfile for multi-branch project as mentioned in https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#creating-multibranch-projects you should always add checkout scm command. 
403 error is a Jenkins bug I believe, but it may be suppressed by disabling CSRF protection as a workaround.
Reply all
Reply to author
Forward
0 new messages