1111App\Models\Blog Object ( [table:protected] => blogs [fillable:protected] => Array ( [0] => user_id [1] => date [2] => image [3] => title [4] => slug [5] => detail [6] => post_excerpt [7] => status [8] => tags [9] => related_blog_id [10] => category_id [11] => meta_detail [12] => meta_keyword ) [casts:protected] => Array ( [tags] => array ) [connection:protected] => mysql [primaryKey:protected] => id [keyType:protected] => int [incrementing] => 1 [with:protected] => Array ( ) [withCount:protected] => Array ( ) [preventsLazyLoading] => [perPage:protected] => 15 [exists] => 1 [wasRecentlyCreated] => [escapeWhenCastingToString:protected] => [attributes:protected] => Array ( [id] => 44 [user_id] => 4 [category_id] => 1 [title] => How to Integrate Bitbucket with Jenkins? [slug] => how-to-integrate-bitbucket-with-jenkins [image] => 1709707268How to Integrate Bitbucket with Jenkins.webp [date] => 2022-02-09 [detail] =>
When working on continuous integration and deployment processes for DevOps solution development, a code repository must have an integration with build automation and CI/CD tool. Keeping that under consideration, in this article, we are going to mention steps to effectively integrate Atlassian product Bitbucket with Jenkins. This integration ensures that whenever a code is altered in the Bitbucket Repo, it will automatically reflect in the Jenkins by creating a new build process. Now, let’s get started with the steps to process Bitbucket and Jenkins integration.
At first, create a Bitbucket account (if you don’t have any) using a given link. https://bitbucket.org/account/signin/ Now, log in to the Bitbucket account and click on the Create repository button as shown in the following image. Click on the (+) sign present on the left side of the Bitbucket home page to create a new project/ repository. Give it a name, whichever suits your project. Here, we are going to name it a DevOps demo and include a README.md file. Once all details are filled in, click on the Create repository.
Now, your new Bitbucket Repo is ready.
Log into your Jenkins server and follow the path Dashboard > Manage Jenkins. Click on Manage Jenkins and then on the Manage Plugins.
Manage Plugin section will navigate you to the search field, where you can find the Bitbucket plugin. Select the Bitbucket plugin and click to Install without restart. Once the installation process is done, you can go to the installed section, where you can find your Bitbucket plugin installed.
Now, add the credentials of your Bitbucket account to Jenkins if you’re using a private Bitbucket Repo, which is highly recommended.
Go to the Jenkins dashboard and click on the New Item present on the top for creating a new Jenkins Job. Now give a name to the Jenkins Job. Here, we are naming it as devops-job. Once the naming is done, click on the FreeStyle Project, and then on the OK button to finish the Jenkins job creation.
Once the job is created, go to its Settings, and then Source Code Management.
Add the URL of your Bitbucket Repo in the Repository URL section
Click on the Add button with the dropdown menu, which is present just on the right side of the credential box, in which you’ll have to click on the Jenkins to add/link the Bitbucket username and password.
At last, click on the Add repository button. Go to the Build Trigger select the Build when a change is pushed to Bitbucket checkbox. Once this is done, you can see the Save and Apply pop-up, where click on the Save button.
Now, your Bitbucket and Jenkins accounts are linked.
Open your Bitbucket account and go to the Repository Setting page of the recently created Bitbucket Repo. In the Repository Settings, you’ll find a Webhooks section, click on it and then on the Add Webhook to add a new webhook. Give this new Webhook a name and add the URL of your Jenkins account in the URL field as below. URL Syntax: IP-address/bitbucket-hook/ Once it is added, select the fields as shown in the below image.
And finally, click on the Save button and complete the integration of Bitbucket with Jenkins. Now, you’re all set to automate the code changes reflection from Bitbucket to Jenkins. To ensure the integration of Bitbucket and Jenkins, you can use the following steps.
Go to the Jenkins > devops-job and click on the Build Now option. Go to the Build History and then Console Output to check the output.
If the output doesn’t show any error, the build will reflect the red colour, which shows a successful integration of Jenkins with Bitbucket. Thus, whenever a new code commits from Bitbucket, the Jenkins job will create a new build automatically. Jenkins and Bitbucket integration success can also be checked from the Bitbucket. Go to your Bitbucket Repo, which you’ve recently created, and add a new file by clicking on the Add file button as shown in the image to check whether the changes in the file done through Bitbucket reflect in the form of build creation in Jenkins or not.
(For this testing, a terminal can also be used once Bitbucket Repo cloning is done using Git commands.) Here, we are creating a simple PHP file. Once the file is created, click on the Commit button.
Now, go to the Jenkins and check for the build history, whether the new build has triggered or not.
Also, check for the Workspace files.
If you find a new build and workspace file, consider that your Bitbucket and Jenkins are successfully integrated.
Used the same process but got stuck somewhere in your DevOps project? Let us know your doubts and queries related to your Jenkins project. For more information on our DevOps services and solutions related offerings, please visit this page. You can also book your first free 60 mins of DevOps consultation service with our DevOps experts.
[post_excerpt] => To automate the DevOps project development, many developers integrate Jenkins with Bitbucket. This way they can get builds for every new code commit. Click on the link to know the integration steps. [tags] => [related_blog_id] => 44 [status] => 1 [featured] => 0 [meta_detail] => To automate the DevOps project development, many developers integrate Jenkins with Bitbucket. This way they can get builds for every new code commit. Click on the link to know the integration steps. [meta_keyword] => [created_at] => 2023-01-10 03:44:50 [updated_at] => 2024-03-06 12:11:08 ) [original:protected] => Array ( [id] => 44 [user_id] => 4 [category_id] => 1 [title] => How to Integrate Bitbucket with Jenkins? [slug] => how-to-integrate-bitbucket-with-jenkins [image] => 1709707268How to Integrate Bitbucket with Jenkins.webp [date] => 2022-02-09 [detail] =>When working on continuous integration and deployment processes for DevOps solution development, a code repository must have an integration with build automation and CI/CD tool. Keeping that under consideration, in this article, we are going to mention steps to effectively integrate Atlassian product Bitbucket with Jenkins. This integration ensures that whenever a code is altered in the Bitbucket Repo, it will automatically reflect in the Jenkins by creating a new build process. Now, let’s get started with the steps to process Bitbucket and Jenkins integration.
At first, create a Bitbucket account (if you don’t have any) using a given link. https://bitbucket.org/account/signin/ Now, log in to the Bitbucket account and click on the Create repository button as shown in the following image. Click on the (+) sign present on the left side of the Bitbucket home page to create a new project/ repository. Give it a name, whichever suits your project. Here, we are going to name it a DevOps demo and include a README.md file. Once all details are filled in, click on the Create repository.
Now, your new Bitbucket Repo is ready.
Log into your Jenkins server and follow the path Dashboard > Manage Jenkins. Click on Manage Jenkins and then on the Manage Plugins.
Manage Plugin section will navigate you to the search field, where you can find the Bitbucket plugin. Select the Bitbucket plugin and click to Install without restart. Once the installation process is done, you can go to the installed section, where you can find your Bitbucket plugin installed.
Now, add the credentials of your Bitbucket account to Jenkins if you’re using a private Bitbucket Repo, which is highly recommended.
Go to the Jenkins dashboard and click on the New Item present on the top for creating a new Jenkins Job. Now give a name to the Jenkins Job. Here, we are naming it as devops-job. Once the naming is done, click on the FreeStyle Project, and then on the OK button to finish the Jenkins job creation.
Once the job is created, go to its Settings, and then Source Code Management.
Add the URL of your Bitbucket Repo in the Repository URL section
Click on the Add button with the dropdown menu, which is present just on the right side of the credential box, in which you’ll have to click on the Jenkins to add/link the Bitbucket username and password.
At last, click on the Add repository button. Go to the Build Trigger select the Build when a change is pushed to Bitbucket checkbox. Once this is done, you can see the Save and Apply pop-up, where click on the Save button.
Now, your Bitbucket and Jenkins accounts are linked.
Open your Bitbucket account and go to the Repository Setting page of the recently created Bitbucket Repo. In the Repository Settings, you’ll find a Webhooks section, click on it and then on the Add Webhook to add a new webhook. Give this new Webhook a name and add the URL of your Jenkins account in the URL field as below. URL Syntax: IP-address/bitbucket-hook/ Once it is added, select the fields as shown in the below image.
And finally, click on the Save button and complete the integration of Bitbucket with Jenkins. Now, you’re all set to automate the code changes reflection from Bitbucket to Jenkins. To ensure the integration of Bitbucket and Jenkins, you can use the following steps.
Go to the Jenkins > devops-job and click on the Build Now option. Go to the Build History and then Console Output to check the output.
If the output doesn’t show any error, the build will reflect the red colour, which shows a successful integration of Jenkins with Bitbucket. Thus, whenever a new code commits from Bitbucket, the Jenkins job will create a new build automatically. Jenkins and Bitbucket integration success can also be checked from the Bitbucket. Go to your Bitbucket Repo, which you’ve recently created, and add a new file by clicking on the Add file button as shown in the image to check whether the changes in the file done through Bitbucket reflect in the form of build creation in Jenkins or not.
(For this testing, a terminal can also be used once Bitbucket Repo cloning is done using Git commands.) Here, we are creating a simple PHP file. Once the file is created, click on the Commit button.
Now, go to the Jenkins and check for the build history, whether the new build has triggered or not.
Also, check for the Workspace files.
If you find a new build and workspace file, consider that your Bitbucket and Jenkins are successfully integrated.
Used the same process but got stuck somewhere in your DevOps project? Let us know your doubts and queries related to your Jenkins project. For more information on our DevOps services and solutions related offerings, please visit this page. You can also book your first free 60 mins of DevOps consultation service with our DevOps experts.
[post_excerpt] => To automate the DevOps project development, many developers integrate Jenkins with Bitbucket. This way they can get builds for every new code commit. Click on the link to know the integration steps. [tags] => [related_blog_id] => 44 [status] => 1 [featured] => 0 [meta_detail] => To automate the DevOps project development, many developers integrate Jenkins with Bitbucket. This way they can get builds for every new code commit. Click on the link to know the integration steps. [meta_keyword] => [created_at] => 2023-01-10 03:44:50 [updated_at] => 2024-03-06 12:11:08 ) [changes:protected] => Array ( ) [classCastCache:protected] => Array ( ) [attributeCastCache:protected] => Array ( ) [dates:protected] => Array ( ) [dateFormat:protected] => [appends:protected] => Array ( ) [dispatchesEvents:protected] => Array ( ) [observables:protected] => Array ( ) [relations:protected] => Array ( ) [touches:protected] => Array ( ) [timestamps] => 1 [hidden:protected] => Array ( ) [visible:protected] => Array ( ) [guarded:protected] => Array ( [0] => * ) )