General Vision
In the end of this tutorial, your Jenkins will execute every Bitbucket open pull request and post a coment with the commit number, link to console output, link to coverage report.
Go to my Github page and fork the master version of shell script.
Your comments on bitbucker will be just like this:
Configuration
Create a new job on your Jenkins and select the option:
” Build multi-configuration project “
Settings Screen
Inside GitBucket config, select “This build is parameterized” and create one parametrized value for each variable above:
- OWNER = bitbucket owner
- BUCKET_API_V1_URL = bitbucket.org/api/1.0/repositories
- BUCKET_API_V2_URL = api.bitbucket.org/2.0/repositories
- REPO = $repository
- USERNAME_BITBUCKET = username
- PASSWORD_BITBUCKET = p4ssw0rd
- USERNAME_JENKINS = username
- PASSWORD_JENKINS = p4ssw0rd
- JENKINS_URL = your_jenkins_url.com
- LANGUAGE = program language (python or ruby)
“Source Code Management”
Select “Git” and insert your bitbucket link with this pullrequest script.
“Build Triggers”
Select “Poll SCM” and insert your crontab to Jenkins validade with bitbucet if there is a open PR. In my project, the Jenkins validate every 5 minutes.
“Configuration Matrix”
Create a “User Defined Axis” with the “name: repository” and on the values, inseert your Bitbucket repository name.
“Build”
Include this script on the “Execute Shell”
Configure Code analisys
“Post Build Actions”
On Python
Activate the Cobertura Plugin “Publish cobertura coverage Report” and insert the location of the coverage report, on .xml format.
- **/coverage.xml
On Ruby
The ruby coverage will be generated on HTML format.
This script will bee function only if you are using python or ruby language and configure coverage report on your tests.
VERY Important Note
ci.sh is the file when I execute my environment configuration to run the tests.
####Thanks for your attention and be welcome to send me a message if you have any question or improvement to this post.
#See Ya