Atlassian Team members are employees working across the company in a wide variety of roles.
November 14, 2019 edited
Hi. I’m Zoe and I’m a designer on Bitbucket Server.
Right now, we’re working on a project to streamline Bitbucket’s CI workflow. We’re looking into extending Bitbucket’s capability to integrate with Jenkins, and we’re interested in learning more about the capabilities you’re interested in as well as getting your input and feedback on our vision.
We’d love to speak to you. If you can spare an hour to talk, email me at ztrakosas@atalssian.com
We have been working with other plugins to implement CI workflow. Generic Webhook Plugin injects payload info in the BuildInfo environmental var in our Jenkins pipeline environment, BitBucket plugin injects this info in the BITBUCKET_PAYLOAD environmental var in our Jenkins environment, but we don't found how BitBucket Server Integration plugin is injecting this info in Jenkins.
According to the webhook event details, It's sending this info as payload:
{ "eventKey": "repo:refs_changed", "date": "2019-11-27T16:01:32+0100", "actor": { "name": "UserID", "emailAddress": "user@correo.interno", "id": 3731, "displayName": "UserName", "active": true, "slug": "user", "type": "NORMAL", "links": { "self": [{ "href": "https://bitbucket:8443/users/user" }] } }, "repository": { "slug": "app_name", "id": 72, "name": "app_name", "scmId": "git", "state": "AVAILABLE", "statusMessage": "Available", "forkable": true, "project": { "key": "project_name", "id": 122, "name": "project_name", "public": false, "type": "NORMAL", "links": { "self": [{ "href": "https://bitbucket:8443/projects/project_name" }] } }, "public": false, "links": { "clone": [{ "href": "ssh://git@bitbucket:7999/project_name/app_name.git", "name": "ssh" }, { "href": "https://bitbucket:8443/scm/project_name/app_name.git", "name": "http" }], "self": [{ "href": "https://bitbucket:8443/projects/project_name/repos/app_name/browse" }] } }, "changes": [{ "ref": { "id": "refs/heads/develop", "displayId": "develop", "type": "BRANCH" }, "refId": "refs/heads/develop", "fromHash": "a35e06ffa0b44173daabb017336569186228eab9", "toHash": "99f5d2ca498cbab381de06c598026d90e4d40c42", "type": "UPDATE" }] } We need this info to cover several audit requirements in our CMDB, as well as to generate a change report to pass to QA pipeline with the modified files between fromHash and toHash commits
We are actually using these fields in our process.
Unfortunately, we don't have this capability right now. We think it will be good to provide this in future but I can't provide any timeline. Can you please create a suggestion at https://issues.jenkins-ci.org with atlassian-bitbucket-server-integration-plugin as the component?
Thanks for the feedback. Please see my comments inline.
> I really like the overall integration between JIRA, Bitbucket Server and Bamboo (creating an issue creates a new branch, pull request requires a successful build etc) but I miss the pipeline in Bamboo compared to Jenkins.
Can you please expand on what capabilities you find missing in Bamboo re pipeline.
> Is there already a possiblity to use the power of JIRA and Bitbucket Server together with Jenkins or are there plans to support it?
With the new plugin (what this is post is about) you can get a well integrated workflow between Bitbucket and Jenkins. In future, we will post build information to Jira like we do with Bamboo. Are there any other capabilities that you'd want?
Bitbucket Branch Source plugin uses Git SCM and sets the refspec to +refs/pull-requests/*/from:refs/remotes/origin/* to build pull-requests to the main repository from forks. I can't find how to configure the refspec with Bitbucket Server SCM. Is there another way to automatically build pull requests ?
We are using the folders plugin to organize and restrict permissions to jobs. Having the "configure jobs" permission set on the folder level does not seem enough for this plugin to work (fields missing when selecting Bitbucket as the SCM), it required to give users this permissions on the system level -- not good.
I have set up a pipeline job and I want to build any commit pushed to Bitbucket. Therefore I have set the branch specifier to **.
The pipeline is checked out from the repo. But it doesn't work as expected. The job checks out random commits. The instructions provided by Atlassian show only */master. I don't know whether that is related to https://issues.jenkins-ci.org/browse/JENKINS-60809.
How is that supposed to work?
Given that this is an official Atlassian plugin and the version has already reached 1.0 I am very disappointed with both the quality and the capabilities of this plugin. In its current state it is effectively useless for any kind of serious CI. We want to build and test commits **before** they enter master, not after.
A much better (more flexible, reliable and transparent) solution is to use the Pull-request-notifier plugin in Bitbucket together with the Generic Webhook trigger plugin in Jenkins.
I'm sorry that you're disappointed with he plugin. If you check the tooltip for 'Branches to build' it clearly mentions leave the field blank to examine any branch for building.
Can you try this and let us know if it works? Also, it will really help us if you can tell the other concerns you have regarding the quality and capabilities of this plugin?
We are using it to great success here. Something I noticed and not sure if this is a "feature" or a "bug".
I have observed recently that if you initially set up a hook to look at master and then go back and update to include another branch, in this case it did not appear to update the hook to include both branches. I had to turn it off save then turn it on again and the update took place. Other than that its a fantastic solution for us. Keep up the great work
Can you please raise a bug at https://issues.jenkins-ci.org with atlassian-bitbucket-server-integration-plugin as the component? We'll triage and get back to you with updates.
I get "Connection failure, please try again", despite having followed the instructions at stated without problem. We are running Bitbucket Server 6.10.1 and Jenkins 2.190.3, with Bitbucket SErver Integration plugin 1.1.0.
I do not see any relevant information in our /var/log/jenkins/jenkins.log after this failed connection test.
Anyone else experience this, or know what I should try next? Thanks.
thank You for Your reply. When I leave the branch specifier empty, Jenkins will automatically replace it with ** the next time I open the page. I suppose that this has nothing to do with my problem.
How can I make the plugin build **any** commit that is pushed to bitbucket, regardless of the branch name. I am using a pipeline job with a pipeline file in the bitbucket repo.
The error I get is that Jenkins checks out random commits, at least not from the branches that I have pushed.
Hello, I have searched high and low for the answer to this but cannot find it anywhere to so taking the chance this thread is still being watched. I saw support for multibranch pipelines is now available in the latest version of the plugin.
I cannot find anywhere where this is detailed. The problem is that I am not presented with the option to set the Bitbucket Server Trigger Build After push option in the job config screen.
The documentation around this is a little sparse so since I am using a multibranch pipeline I thought that maybe it needed to be added to my Jenkinsfile for each of the branches etc. as @Kristy was so kind to point out before. Problem is when I go into the snippet generator and select the build properties option I do not see an option to generate that little nugget.
Can anyone who has successfully implemented this in a multibranch help a brother out? Going bald pulling my hair out on this.
Atlassian Team members are employees working across the company in a wide variety of roles.
May 7, 2020 edited
Hi @Dinsen, I'm one of the developers on Bitbucket Server.
Thanks for your interest in the SSH cloning feature. Unfortunately, the solution is not ready for release due to some testing issues in Java 11 that we are still working to resolve. This feature is being tracked in JENKINS-60492, and if you're interested you can follow the progress of the feature itself on the Github pull request.
I try to integrate Jennkins and Bitbucket server with "Bitbucket Server Integration" plugin. I configure personal access token and after pipeline job creation webhook is created in Bitbucket server. Git access is working and status from Jenkins job is presented in Bitbucket server.
The problem that I have is with triggering Jenkins job on git push. I receive this error:
You should be able to provide which branches/tags to build in 'Branches to build' field. If this is not what you're expecting, can you please expand on your use case to help us understand the flow better.
Can you please create an issue at at https://issues.jenkins-ci.org with atlassian-bitbucket-server-integration-plugin as the component. This will help team triage and track the issue.
72 comments