Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to visualize deployment using the Jenkins Dashboard plug-in

Shulou Source: shulou.com Published: 2022-06-01 18:39:30 10月05日 Update

This article introduces the knowledge of "how to use the Jenkins Dashboard plug-in to visually deploy". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Visualize deployment using Jenkins

Plug-in address: https://plugins.jenkins.io/deploy-dashboard/ plug-in name: Deploy Dashboard by Namecheap

Have you ever asked yourself or your colleagues, "which version is currently deployed in the development environment?" Or "did you deploy the patch to production yesterday?" Or "our customer encountered an error two days ago. Do you remember the version deployed at that time?"

If you often have problems like this, and you use Jenkins for its CI / CD processing, then this plug-in is perfect for you!

In the field of agile development, we have to update software applications very frequently. Each version should be deployed in many environments. In the end, things got messed up when we talked about which version to deploy to which environment. It would be nice to put the overall deployment in one place, right?

At Namecheap, we use Jenkins for CI/CD. Therefore, we decided to ensure that each deployment status is always checked by writing a Jenkins plug-in called Deploy Dashboard.

In this article, I'll show you what the plug-in does and how to use it.

Visualization with Deploy Dashboard

First, we want to know which code releases have been deployed to which test and production environments (or devices). To achieve this goal, we created a custom view to use as a dashboard.

In addition, you can view the publishing history by clicking on a specific environment.

Getting started: add a new version to the dashboard

Suppose you already have a Jenkins job to build and deploy your application. The only thing you need to do is addDeployToDashboard to call the method with the environment name and application 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 home page or folder, click the + tab to start the New View Wizard (if you don't see +, you may not have permission to create a new view).

On the create New View page, name the view, select the deployment View type, and then click OK.

Regular expressions can be used to specify jobs to include in the view. (for example: ". *" will select all jobs in the folder).

Add the deploy button to your version

In some cases, you want to keep the CI pipe separate from the CD. In this case, Deploy Dashboard Plugin allows you to add additional buttons to the build sidebar. You should only call buildAddUrl methods 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}")}}

This feature is very useful for the quality inspection team. With just a few clicks, they can deploy any existing version to their environment. I hope it helps to improve your experience with Jenkins! You are welcome to contribute to the project in GitHub.

Declarative script

Pipeline {agent any parameters {choice choices: ['dev','prod'], description:'', name: 'env' string defaultValue:', description:'', name: 'version' Trim: false} stages {stage ('Hello') {steps {script {addDeployToDashboard (env: params.env) BuildNumber: params.version)} "how to deploy visually using the Jenkins Dashboard plug-in" ends here Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Version plug-in environment view visualization situation program instrument application dashboard job application content function name address button file folder method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Huawei MariaDB Linux Xiaomi