Integrating with Jenkins

4 minute read
Jenkins integration is a Preview feature.
Preview

A Preview feature:

  • Has not undergone end-to-end testing with CloudBees products

  • Is provided without service-level agreements (SLA) and therefore does not include CloudBees' commitment on functionality or performance

  • May impact other stable areas of the product when used

  • May have limited documentation

  • May not be feature complete during the Preview period

  • May graduate from preview state to fully supported or be removed from the product

  • May introduce incompatible, backward-breaking changes that could revoke the ability to upgrade

Product features and documentation are frequently updated. If you find an issue or have a suggestion, please contact CloudBees Support.

The CloudBees Feature Management Jenkins Plugin allows users to create, update, or delete feature flag configurations as a part of build steps within the continuous integration workflows.

The plugin communicates via the REST API to enable the required task for a feature flag configuration to be automated within Jenkins.

This page describes how to do the following:

  • Manually install and enable your plugin in Jenkins

  • Add the action before code is run

  • Access the flag created in production CloudBees Feature Management after code is run

  • Review the CloudBees Feature Management audit log

  • Manually delete the CloudBees Feature Management Jenkins plugin from the production environment

Setting up the CloudBees Feature Management Jenkins plugin

Before you can use this plugin, you must do the following steps in the order listed to set up the plugin.

Downloading the CloudBees Feature Management Jenkins plugin from GitHub

To download the plugin:

  1. Select cloudbees-feature-management.hpi.zip to automatically download the zip file to your computer.

  2. Locate the cloudbees-feature-management.hpi.zip file in your computer’s Download folder and unzip it.

Installing the CloudBees Feature Management Jenkins plugin

After the plugin has been downloaded, it needs to be uploaded and enabled before it can be installed.

  1. After signing in to Jenkins, select Manage Jenkins Manage Plugins.

  2. Verify that the plugin is not already installed. On the Installed tab, type CloudBees Feature Management Jenkins, in the Filter field. If the plugin appears, then it is already installed.

  3. On the Advanced tab under Upload Plugin select Choose File.

  4. Select cloudbees-feature-management.hpi Open to add the hpi file for upload.

    Figure 1. The plugin is selected and ready for upload.
  5. Select Upload.

  6. From the Installing Plugins/Upgrades page, verify that the plugin has successfully been uploaded.

    Figure 2. The file has successfully installed.

Enabling the CloudBees Feature Management Jenkins plugin

To enable the plugin:

  1. Access CloudBees Feature Management from app.rollout.io and navigate to the application dashboard. Choose the application with the feature flags you would like to control with the plugin.

  2. In the left pane, select App Settings Integration.

  3. From API User Token, select Show to display the user token.

    Figure 3. Selecting the Show button.
  4. Select Copy.

    The Application Id will be needed at a later step in the process.
  5. From Manage Jenkins Manage Credentials select Jenkins Global credentialsAdd Credentials to open the Global credentials (unrestricted) page.

  6. Select Kind Secret text.

  7. Paste the CloudBees Feature Management user token from your clipboard into Secret.

    Figure 4. Selecting Add Credentials.
  8. Optionally enter a description in the Description field.

  9. Select OK to generate a new ID.

    Figure 5. A new ID is generated.
  10. Right-click the ID and select Copy.

  11. From within the Jenkins dashboard, go to Manage Jenkins Configure System.

  12. Under CloudBees Feature Management paste the ID from your clipboard into Access Token Credential ID, and select Save.

Copying the plugin ID to your production environment

Now that your plugin has been installed and enabled, the ID must be added before it can be used in production.

To copy the Application Id from CloudBees Feature Management:

  1. Access CloudBees Feature Management from app.rollout.io.

  2. In the left pane, select the current application.

  3. In the dialog that opens, select the correct application from the drop-down list.

  4. In the left pane, select App Settings Integration.

  5. From API Application Id, select Show to display the ID.

  6. Select Copy.

  7. From within the Jenkins dashboard, select the project you would like to add a feature flag to.

  8. Select the Configure Build tab to jump to the Build menu.

  9. Select Add build step Feature Management Configuration.

  10. Paste the Application Id from your clipboard into the Application ID field.

Your plugin is now ready for use.

Using the CloudBees Feature Management Jenkins plugin

To begin using the plugin:

  1. After pasting Application Id from the previous step, add the environment name corresponding to the environment where the resulting feature flag configuration should be enabled.

    Flag updates will NOT execute if this field is not specified. For example, you’ll be able to create a flag, but will not be able to enable it or set other environment specific properties.
  2. Select the ? next to view the Feature Flag "Set" (create and/or configure) and "Delete instructions.

  3. Next to Feature Flag configurations select the ? to view the Help for feature: Feature Flag configurations instructions.

  4. Use the examples to configure your flag within Feature Flags configurations.

  5. Select Save to add the flag to your production environment.

    Figure 6. Configuring a flag using the examples in the Feature Flag configurations instructions.
    For more information, refer to The REST API.

    After the code is run, it can be accessed from CloudBees Feature Management.