Jenkins integration to feature branch workflow

Jenkins integration to feature branch workflow

We wrote earlier about how code reviews work in Deveo. The blog post covered how the successful Git branching model and its derivates can be implemented efficiently in Deveo with code reviews and mandatory approvals. In this blog post, we are going to build another feedback cycle on top of the basic code review workflow that relies only on another human reviewer. The new feedback cycle is feedback from automatic build tools such as Jenkins. This blog post covers how to set up a feature branch workflow that requires a successful (green) build from Jenkins before the feature branch can be merged into the target branch in Deveo.

If you want to see rather than read, watch the video below:

Initial setup

This post assumes that we are in a situation where we left off at the previous blog post. In the previous post, we set up a Deveo project and created a new Git repository. We also created some feature branches to the Git repository.

What we want to do next is to set up Jenkins job to be triggered for the feature branches in this repository. We also want Jenkins not just to execute the build, but also to notify Deveo whether the build succeeded or failed. For setting this all up, we need four things:

  1. Set up a Deveo bot account for programmatic access
  2. Set up Deveo Jenkins hook for triggering the Jenkins build
  3. Configure the Jenkins job to build feature branches, and
  4. Install and configure Jenkins Deveo plugin

1. Set up a bot account for programmatic access

Deveo has a unique concept called bot accounts, or simply bots. Bots are used for external access to Deveo APIs as well as version control systems. Configuring a continuous integration server is an ideal example for using bots instead of your personal credentials.

Setting up a bot account in Deveo is done through bots UI. Bots can be created by users with access to Deveo. When a bot is created the creator becomes the owner of the bot. We can share the ownership of the bot accounts between multiple users. In this example, we don't need to assign others as owners or members of the bot, but simply add the bot to the project.

Managing bots in Deveo

Adding a bot to a given project is done in the team view of the project. For this purpose, we assign the bot as a guest role, since only read access to the code is required, and bots with guest access are able to publish build events. For a complete description of bot credentials, see Deveo user guide.

Two bots in a project

2. Set up Jenkins hook for triggering the build

Next, we want to set up a Jenkins hook for triggering our build for each change in our feature branches. Hooks are managed in the project hooks view. Deveo supports over 80 hooks to different services. After adding Deveo Jenkins hook to a Git repository, a commit hook posts a request to http://yourserver/git/notifyCommit after each change, in correspondence to Jenkins Git Plugin documentation.

Adding a Jenkins hook in Deveo

3. Configuring Jenkins Job

After we have everything set up from Deveo point of view, let's jump into Jenkins and create a new job, and configure necessary job-related settings.

Add the clone URL for the repository to the job configuration. Deveo supports both SSH and HTTPS protocols for repository access and while SSH is typically preferred over HTTPS, in this example we use HTTPS for simplicity.

Configure branches to build to refs/heads/features/**. This makes Jenkins run the job only upon changes to branches that are prefixed with features/, e.g. features/login, features/logging, features/foo, and so on.

Jenkins job with Deveo Git repository configured

Next, add your bot credentials to the configuration. You can find the bot credentials in Deveo either from the project team view or in the company bots view by clicking the cogwheel icon next to the bot name.

Deveo Bot credentials

In order for Deveo Jenkins hook to start the execution of this job, you will need to enable the Poll SCM option in the Job configuration. No polling schedule is required to be set, however. This is needed for Jenkins to distinguish which builds should be started upon changes, and which not.

Setting up the actual build steps are project specific, and are thus skipped in this post. You can find a plethora of information on configuring the build and test automation for your application in question.

4. Configure Jenkins Deveo plugin

Deveo Jenkins plugin can be installed from the Jenkins plugin manager. It should be configured according to the plugin instructions. After installing and configuring the plugin, there should be a new post build action available in the Jenkins job configuration named Deveo notification.

In order to configure Jenkins to send the build information successfully, you need to add the Deveo notification post build action and configure the account key of the bot account to it. This way Deveo Jenkins plugin utilizes the correct credentials when creating the event. After setting the post build action and saving the Jenkins job settings, everything is set for proper testing.

Testing the setup.

We can now test the setup by creating a feature branch named features/new-feature. We can create a couple of commits to the branch, and push it to Deveo. Once the branch is pushed we can create a new code review with the branch against the master branch and choose the Require passing build option.

Choosing the require passing build option disables merging the changes through Deveo web interface until there is a notification of successful build sent to Deveo for the given branch. The changes can be still merged manually through command-line, which is sometimes useful.

Deveo new code review with passing build requirement

When we click the Create button and open the code review, we should see that the Build event is already green and that the merging the changes is possible. Naturally, when doing actual automated builds and verifications, the build might take longer, and the successful or unsuccessful status would only be shown after the build is executed.

Deveo code review with successful build event


Setting up Jenkins integration to feature branch workflow provides a quality gate for new features under development. This post explained how to set it up in Deveo and Git repositories. Similar workflow can be achieved also in Mercurial repositories.

If you would like to test the functionality yourself, sign up for free. If you have any feedback, comment the post below, or if you found this post useful, share it around.

Seamless software development.

Code management and collaboration platform with Git, Subversion, and Mercurial.

Sign up for free
comments powered by Disqus