Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

Plugin Information

View Environment Dashboard on the plugin site for more information.

Summary

**Note - Enable Auto Refresh at the top right of the view so that the view is auto updated.

This Jenkins plugin creates a custom view which can be used as a dashboard to display which code release versions have been deployed to which test and production environments (or devices).

You can also click on the environment name to get a historical view of the deployments.

Example Set up

You have 3 software components:

  • UI
  • Web Application and API
  • Database

Each component has a corresponding Jenkins "build and package" job that creates new environment agnostic build packages and puts the code into something like Nexus waiting for someone to pick it up and deploy it.

You have 4 environments

  • CI Test
  • Performance Test
  • Pre-production
  • Production

You have Jenkins jobs for deploying build packages to your environments.

You find it hard to track which version of each application is currently deployed to.

You configure your deployment jobs to publish a record of each deployment to this plugin.

You create a view which displays a matrix with rows for your 3 applications, columns for your environments and the intersections with the deployed code version.

Other information

Configuration

After installing the plugin, you'll get a new option in the Build Environment section of a job configuration page. If your job deploys to an environment, check the box and complete the form using the context sensitive help.

You can also specify how long to retain the dashboard data, the default is set to 30 days. Any data older than 30 days from the current time is automatically deleted.

Once you have run at least one job with a populated Details for Environment dashboard section, you now have enough data to generate a dashboard. On the Jenkins home page, click the + to create a new view and create a view. If you leave all settings blank, you will see the deployments of all components into all environments. You can also limit the deployment history shown when you click on the environment name on the dashboard. The default is last 10 deploys.

Job DSL

environmentDashboard {
    environmentName(String environmentName)
    componentName(String componentName)
    buildNumber(String buildNumber)
    buildJob(String buildJob)
    packageName(String packageName)
    addColumns(boolean addColumns)
    columns(String columnName, String contents)
}
The groovy DSL can be used in conjunction with Job DSL plugin to provide a definition of environment dashboard section within a job.

Examples
job('example-1') {
    wrappers {
        environmentDashboard {
            environmentName('Environment-1')
            componentName('WebApp-1')
            buildNumber('Version-1')
          }
        }
}

// Add custom columns
job('example-2') {
    wrappers {
        environmentDashboard {
            environmentName('Environment-1')
            componentName('WebApp-1')
            buildNumber('Version-1')
            addColumns(true)
            column('Col1', 'Column 1 contents')
            column('Col2', 'Column 2 contents')
          }
        }
}
  • No labels

5 Comments

  1. Unknown User (ebrahim_moshaya)

    I'm getting an error post build to update the dashboardPost-Build Update: Error running query UPDATE env_dashboard SET buildStatus = 'SUCCESS', created_at = current_timestamp WHERE envComp = 'Hermes Test=Mobile Management Organisation Service' AND joburl = 'job/Project/job/Services/job/MobileManagementOrganisation-Service/job/MobileManagementOrganisationService-Deploy/33/';.

    This is affecting our dashboard as it seems as though the deploy is still running.

    1. Unknown User (ebrahim_moshaya)

      Just had a different error with the environment dashboard not updating to reflect job status.Post-Build Update: WARN: Could not alter table env_dashboard.

  2. Unknown User (stewartev)

    I'm having trouble figuring out how to use this in conjunction with the build user vars plugin.  I have tried a simple test job with "

    Set jenkins user build variables" checked, and as my build number I am trying to use $

    Unknown macro: {BUILD_USER_ID}

    .  This doesn't get expanded in the dashboard.  However in my shell build step,  "

    echo $BUILD_USER_ID" works as expected.

    Am I missing something?

    1. Unknown User (vignesh12)

      It's working in shell build step "echo $BUILD_USER_ID" because variables from Build user vars plugin will get expanded in all the steps/sections which is present below "Set jenkins user build variables". As the "Details for environment dashboard" section is present above the "Set jenkins user build variables", variables are not yet expanded and not available for dashboard. It simply gets updated without the expanded values as a pre-build update.

      Either "Details for environment dashboard" has to be renamed to "Set values for environment dashboard" in source code or the post-build update of the DB in the source code has to be updated to resolve this.

      1. Unknown User (caley)

        I'm seeing this same thing. Basically I want to update a variable set in the environment dashboard configuration called VERSION.  I populate that variable in the build with a number so I know it exists. However the Post-build update of the Dashboard DB never expands the VERSION.

        --I set up VERSION in the env dashboard configuration by using a custom column.

        Is there a chance this will be resolved?