Go To Namecheap.com
Developers, Engineering

Visualize Your Deployment Status with Jenkins

Have you ever asked yourself or your colleague  “Which version is currently deployed on the development environment?” or “Hey John, did you deploy that fix to production yesterday?” or “Bill, our client experienced a bug two days ago. Do you remember which version was deployed at that time?”. 

If questions like this regularly pop up, and you use Jenkins for their CI/CD process, this plugin is definitely for you!

In the world of Agile development, we have to update our software applications very often. Each version should be deployed to numerous environments. Eventually, it becomes a mess when we talk about which version is deployed to which environment. It would be nice to have an overall deployment status in one place, right?

At Namecheap,  we use Jenkins for CI\CD processes. So we decided to make sure we could always check every deployment status by writing a Jenkins plugin called Deploy Dashboard

In this article, I will show you the capabilities of the plugin and how to use it.

Visualizing with Deploy Dashboard

First of all, we wanted to know what code release versions have been deployed to what test and production environments (or devices). To cover this goal we made a custom view that is used as a dashboard.

deployment view
Full size image

Moreover, it is possible to look at release history by clicking on a specific environment.

release history
Full size image

Getting Started: Add a New Release to Dashboard

Let’s assume that you already have a Jenkins job that builds and deploys your application. The only thing you have to do is to call the addDeployToDashboard method with the environment name and app version parameters.

properties([parameters([
  string(

name: 'version',
description: 'App version to deploy'
),
  choice(
      name: 'env',
      choices: ['dev', 'prod'],
      description: 'Environment where the app should be deployed'
  )
])])
node {
  //...
  stage("Deploy") {
      // Deploy app version ${params.version} to ${params.env} env
     
      //add release information to the dashboard
      addDeployToDashboard(
          env: params.env,
          buildNumber: params.version
      )
  }
}

Create a Dashboard

On the Jenkins main page or folder, click the + tab to start the new view wizard (If you don’t see a +, it’s likely you do not have permission to create a new view). 

add new view
Full size image

On the “create new view” page, give your view a name and select the Deployment View type and click ok.

create new view
Full size image

A regular expression can be used to specify the jobs to include in the view. (e.g.: “.*” will select all the jobs in the folder).

deployment view
Full size image

Add Deployment Buttons to Your Build

There are cases when you want to keep your CI pipeline separately from CD one. In this case, the Deploy Dashboard Plugin allows you to add additional buttons to the build sidebar. You should just call a  `buildAddUrl` method with a title and URL address.

node {
  stage("Build") {
      String builtVersion = "v2.7.5"
      // Build app with ${builtVersion} version

      //Add buttons to the left sidebar
      buildAddUrl(title: 'Deploy to DEV', url: "/job/app-deploy/parambuild/?env=dev&version=${builtVersion}")

      buildAddUrl(title: 'Deploy to PROD', url: "/job/app-deploy/parambuild/?env=prod&version=${builtVersion}")
  }
}
deploy button
Full size image

This feature can be extremely useful for the QA team. They will be able to deploy any existing version to their environment just in a few clicks.

I hope this helps to improve your experience with Jenkins! You are welcome to contribute to the project in Github.

Was this article helpful?
3
Vitalii Sydorenko avatar

Vitalii Sydorenko

I have good experience with Software Engineering with a focus on web-services and DevOps process. Worked in various companies as Software Engineer, Technical Lead and now am the part of the R&D Technology team at Namecheap. More articles written by Vitalii.

More articles like this
Next Post

Disruptive Thinking During the Global Recession

Read More