Jenkins Integration

Overview

For pre-modeled Jenkins projects (for example, Maven, to fetch the source code from Git/SVN), you can integrate with Workload Manager using the Workload Manager Jenkins plugin.

You do not need to manually copy this file, Cisco provides a download URL to make this plugin available to Jenkins users. Contact CloudCenter Suite Support to obtain the download location.

The Workload Manager Jenkins Plugin

The Workload Manager Jenkins plugin provides complete integration between Jenkins and Workload Manager by allowing users to directly launch deployments on any Supported Cloud from a Jenkins server.  

Additionally, users can upgrade an existing deployment by specifying upgrade scripts for each tier.

Prerequisites

  • If you are new to Jenkins, setup a maven project on Jenkins with Github as its source repository. See http://www.youtube.com/watch?v=lTQGi5jzjvo for additional details.

  • The supported Jenkins versions value to use the Workload Manager Jenkins plugin must be Jenkins 1.624 and later versions.

  • The required Java version for the Jenkins server must be Java 8.

  • You must set the default cloud settings in the Deployment Environments so the Jenkins Plugin can fetch and use those cloud settings when you deploy the application.

  • To attach aging/suspension/security policies to a Job deployed by Jenkins, be sure to toggle the switch for the selected policy in the Deployment Environment > Policy Settings tab as Not visible to user to ensure that the policy is automatically attached to the deployment.

  • The Jenkins plugin for Workload Manager requires the Workload Manager APIs for job deployment).  

Install the Workload Manager Jenkins Plugin

To install the Workload Manager Jenkins plugin, follow this procedure:

  1. Contact CloudCenter Suite Support to obtain the download instructions or download the installer_artifacts.tar file from software.cisco.com.

  2. Log into Workload Manager using your admin credentials.

  3. Generate the API Management (Access) Key for the Jenkins user. See API Key for additional details on generating the API key.

  4. Model the Application so this user can access artifacts from the Jenkins build server.

  5. In Jenkins, go to Manage Jenkins > Manage Plugins > Advanced > Upload Plugin to upload and install the Workload Manager Jenkins Plugin.

  6. After you install theCliQrJenkinsPlugin, go to your existing/new project to configure post-build step and fetch the source code from the Git/SVN using a Maven project into the Jenkins Build. Configure the Workload Manager Application Deployment Client in Jenkins for continuous integration from build system and deployment (new or upgrade on an existing node), as shown in the following screenshot.

    The following table lists the parameters for the Workload Manager Application Deployment Client page.


    ParameterDescription
    Cisco CloudCenter Suite URLThe the IP address of the CloudCenter Suite UI. Verify that trusted certificates are used.
    Username

    Username listed in the Manage Access Key section.

    AccessKey

    The API Management Key for the user listed in the he Manage Access Key section.

    Deploy to ProjectUse this flag to deploy to a project, instead of a general deployment environment (see Project and Phase Management for additional context).
    Project NameIf you select the Deploy to Project flag, this parameter is displayed and the list of projects are fetched from CloudCenter Suite. Based on this parameter value, only applications associated with this project are filtered out in the Application Version field.
    Project PhaseBased on the project name, a dropdown list of all Phases in that project are displayed. Use this value in the Deployment Environment field to filter the project.
    Application Name

    From the dropdown list of applications listed in the Workload Manager UI, select the required application to deploy.

    After entering your credentials, be prepare to wait for some time as the Application Management APIs APIs may take a while to load.

    Application VersionBased on your application, select the application version from this dropdown list.
    Deployment EnvironmentSelect the required deployment environment to deploy your application. Be sure to verify and check all default settings like default cloud, default instance type, and so forth as Workload Manager uses these default settings for each deployment.
    Cloud Type

    Select one cloud type from this dropdown list of cloud types that are present in your deployment environment.

    Cloud AccountThe cloud account with which you deploy the application.
    Instance Type

    Select a single instance type as the default instance type.

    TagsA comma-separated list of tags associated with this job.
    AppParameters

    A comma-separated list of key-value pairs to pass as global parameters. For example:
    abcd=wow, cdef=cliqrRocks

    CloudCenter includes the $BUILD_ID, $BUILD_NUMBER, $BUILD_TAG, $JOB_NAME, and if available, $BUILD_TIMESTAMP from other plugins.

    You can add a variable in this section to fetch parameters that are shared by other jobs. For example:
    abc=${BUILD_PARENT_NUMBER} or abc=$BUILD_PARENT_NUMBER

    You also have the option to retrieve parameters from the $WORKSPACE/appParams file that contains multiple lines of key-value parameter pairs. You can then uses these parameters to pass passwords or other sensitive information without displaying them in the Workload Manager UI.

    Choose the binaries to be CopiedIdentifies if the files must be copied to an external location
    • Copy Binaries to External Location – all your binaries will be available under /tmp/app1/latest
    • Don't copy Binaries – the binaries will not be copied to any other location
    Choose the Deployment Behavior

    You can only do this once for deployments.

    • Create a new Deployment on every Build: This option creates a brand new deployment for every build.
    • Stop Old Deployment if exists: This option creates a brand new deployment for every build and stops the older deployment if it exists.
    • Update Existing Deployment (Create new if doesn't Exist):
      • Updates a previous deployment that was launched from the Workload Manager Jenkins plugin during a previous build for the same project.
      • If the previous deployment is still in progress (job) and is not yet in the Running state, the Workload Manager Jenkins plugin waits till the deployment is in the running state before triggering an update (see Deployment, VM, and Container States for additional context).
      • If the previous deployments ends up as an error or if that deployment is stopped or cancelled from the Workload Manager UI, the Workload Manager Jenkins plugin launches a new deployment as part of the Update process.
      • If this is the first build, the Workload Manager Jenkins plugin creates a new Deployment and from the next successful build it uses the existing deployment.
      • UpdateScripts: A comma separated list of tierName:actionId that are executed in the order mentioned here. For example:
        AppCluster:1, Database:2AppCluster:3 where 1,2,3 are the Action ID’s created with the update scripts and parameters like BUILD_ID
      • See Actions Library for additional details on creating a custom deployment update action.
    • Wait For Deployment And Export Details: Waits for Deployment to enter the Running state and exports the Job Details to the $WORKSPACE/userenv file.


The jenkinsBuildId Macro

In Update Scripts, $BUILD_ID or %jenkinsBuildId% can be passed as an argument to point the Binaries to be Copied during an update deployment.

The %jenkinsBuildId% macro is not an applications-specific macro. This Workload Manager-defined macro applies to deployments that are launched using the Jenkins plugin.

The jenkinsBuildId macro is mainly used to pass the Jenkins Build ID to the userenv of the app deployment. Any deployment triggered by the Jenkins plugin will automatically have jenkinsBuildId in the userenv and will be used to point to the right binaries in repo/storage. For example, if a web server has a previous war file path set to /shared/app/petclinic/latest/, then this war file (petclinic.war) can now use this macro to point to /shared/app/petclinic/%jenkinsBuildId%/petclinic.war.

In update deployment scenarios, the jenkinsBuildId macro changes the value that should be passed to existing deployments as userenv has old the jenkinsBuildId value during the deployment.

The folder name that Workload Manager creates in the target location will now use the jenkinsBuildId value instead of the random timestamp value.

Create a New Deployment on Every Build

This option creates a Brand new deployment on every build. 

Update an Existing Deployment 

When you update an existing deployment:

  • It updates a previous deployment that is launched from the Jenkins plugin during the previous builds of the same project.

  • If the previous deployment job is still in progress and is not in the Running state, the plugin waits till it enters the running state and then triggers an update.

  • If the previous deployments ends in an error or if that deployment is stopped/cancelled from the Workload Manager UI, the plugin launches a fresh deployment as part of update.

  • If it is the first build, this plugin creates a new deployment and for the next successful build it uses the existing deployment.

  • If you receive a security group error, be sure to verify if more than one system is accessing the same account.

  • No labels
Terms & Conditions Privacy Statement Cookies Trademarks