Integrate Jenkins with BitBucket Build Status API (Get started with Jenkins part 6)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone and welcome back to the get started with Jenkins series in the previous video I showed you how you can run PHP unit tests with Jenkins now in this video I'm going to show you how you can configure Jenkins so that it sends the status of the build back to bitbucket so why would you want to tell bitbucket about your build status well that's because bitbucket will show the status of each built next to the corresponding commit it's a great way to visually keep track which commits past the built-in which didn't so what's next for this video well first of all I'm going to install the bitbucket build status notifier plugin for Jenkins then we're going to create an OAuth keys on bitbucket and we'll use these keys to configure our Jenkins job afterwards we're going to test our setup and verify that everything works correctly so let's keep going so the first thing that we have to do is we have to create Roth credentials for Jenkins so that it can communicate with bitbucket in a very secure way to do this go to your profile picture and click for I'll click on bit bug bit bucket settings now on the left hand side you'll find a section called access management and underneath it you'll find ooofff and here you have the option to create a new consumer so I'm going to do that click Add consumer I'm going to call my consumer Jenkins and as the callback URL you can use the location or the IP address of your current Jenkins installation so I'm going to pick a little bit here I'm going to copy it paste it there we go and I'm going to give it two permissions I'm going to allow it to read from my repositories and write to my repositories now it's not actually going to write files to your repositories or change files repository it is simply going to write the status update of your build to the repository and that's it I'm going to click Save and afterwards bitbucket generates a key and a secret for this OS consumer which we'll use in the second and Jenkins so let's now install the necessary plugins in Jenkins for this to work so I'm going to install a new plugin in Jenkins just like we did in the previous video by going to manage Jenkins then manage plugins going to the tab available and in here I'm going to search for the plug-in bitbucket there we go bitbucket build status notifier plugin i'm going to click on this and i'm also going to install the bitbucket o alta plugin which enables a lot authentication for bitbucket users so that's exactly what we want so I'm going to click download now and install it to restart to install both these plugins and let's give check-in some time ok so after installing the plug-in a Jenkins restarted itself and now it's time to actually configure our job so let's go to the job click on configure and we're going to add a new post build action this is by the way the same job that would that I used in the last video so I'm going to click on new I'm going to click to add a new post dilt action and I'm going to click on bitbucket notify build status and I want Jenkins to notify bitbucket when we start the build and also when the build is finished and now to send these messages to bitbucket jenkins needs to authenticate itself so I'm going to click on advanced and here I have the option to give it the credentials that it should use to authenticate itself now right now there are no credentials in the system so I'm going to add one here and I'm going to say username and password and as username I'm going to use the key that bitbucket generated for us and as password I'm going to use the secret there we go I can even give it a description for example Oh peas for notifier ok so let me look like ad and we'll use these credentials here and that's it I'm going to click Save and let's now test to see if it actually works and so to do that I'm going to manually trigger a bill so I'm going to click on build now to schedule a build and after a small period of time and there we go our build is finished I can click the seeds details I can see the bill this has run correctly so let's go now to bedbug it to the overview of our repository let's click on commits and here I should and here I see that the latest commit has passed the build but this one has failed to build because I was trying stuff out before filming this video so let's make a new commit and make the test fail again just to show you that this is working correctly so let me go to our gumball machine here and let's say add it I'm going to add it on the bedbug website because it's a little bit faster and I'm a Mac so I'm going to return to gumballs again just as in last video instead of just one and we're going to say this is wrong as commit message I'm going to click commit okay let's now go back to Jenkins go back to my project and start to build again now I'm going to start the bill that I'm going to quickly go back to bitbucket go to the commit section and actually I was already too late the build is already failed you can see that right here normally when you have a bill that takes a couple of minutes to complete this icon actually changes in three dots that tell you that the build is actually still ongoing now if you click on the build icon here you can see that build number four has failed and if you click it it actually the redirects you to your Jenkins installation where you can view more information so that's pretty that's a pretty nice integration so that's it for this video want to learn more about Jenkins or check out the other videos in this series in fact I'll keep adding videos to this series in the future so make sure you subscribe to my channel to get notified whenever I push your new update so thank you very much for watching and I hope to see you in the next one you
Info
Channel: Simply Explained
Views: 32,421
Rating: 4.9636364 out of 5
Keywords: continuous integration, devops, ci, jenkins, introduction, best practices, api, howto, lesson, in action, dummies, basics, tutorial, getting started, basic tutorial, learning, free learning, course, beginner, fundamentals, bitbucket, java, explained, training, free
Id: uu5XcU4EPzQ
Channel Id: undefined
Length: 6min 51sec (411 seconds)
Published: Tue Mar 15 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.