Skip to main content
System StatusContact Support
VersionOne Community

Configuring the Jenkins Plugin

Overview 

The Jenkins Flow plugin in maintained by Continuum for pulling data from Jenkins as well as triggering jobs.

Configuration

Before using the Jenkins plugin, the Jenkins configuration must be updated in the Flow config file.

Edit /etc/continuum/flow.yaml. Edit the file so that it reads as follows. If there are already entries in the file add jenkins before or after. The Jenkins section must be indented as in the example below.

plugins:
    jenkins:
        url: http://jenkins.yourcompany.com:8080
        user: bobthebuilder
        password: password

Enter the url of the Jenkins server where you would normally log in. Sometimes the url has a /jenkins or some other path on the end. The port should be included unless it is port 80. Make sure http or https is set properly.

If the Jenkins server is setup without authentication, don't include the user and password lines in the config.

To have the config changes take effect, restart the Flow job_handler process.

ctm-restart ctm-jobhandler

Configuration files are in the yaml format. See the official YAML documentation for full details about the syntax.

Using the Jenkins Plugin

Once Jenkins has been configured in the flow.yaml file and the service restarted, the Jenkins plugin will display on the Plugins tab of the Stage editor. You can either create a new Stage and add a step that uses the Jenkins plugin or add the Jenkins plugin to an existing Stage.

Variables

All plugins support variable replacement in their properties.

See Plugin Variables for details.

Functions

job.build

job.build will trigger a specified job on the Jenkins server. If the "wait" value was set to "true" it will poll Jenkins until the job is finished. Once the job is finished, job data will be pulled back and stored with the Pipeline Instance.

Properties
  • Job - (required) The Jenkins job name.
  • Wait - (true/false) Whether or not to wait on the Job to complete. Default is 'true'.
Additional Arguments

The Jenkins plugin will accept explicit server details if desired:

{
    "server": {
        "pwd": "mypassword",
        "uid": "bobthebuilder",
        "url": "http://jenkins.mydomain.com"
    }
}

The params argument contains parameters that will be passed to the Jenkins job:

{
    "params": {
        "BRANCH": "[$ git['ref'] $]",
        "COMMIT": "[$ git['after'] $]",
        "NOTE": "This job was triggered by VersionOne Continuum Flow"
    }
}

Phase Data

The job.build plugin will save the job and build values on the phasedata section of the RC. Additionally, a fairly consistent set of data is also saved. (May vary depending on the Jenkins version.) Here's an example of the data saved from a typical use of job.build:

{
    "_pwd": "P1LGPJwpwLurYVAMEdDHtA==",
    "_uid": "bobthebuilder",
    "_url": "http://jenkins.mydomain.com",
    "build": 250,
    "details": {
        "build": 250,
        "causes": [
            {
                "shortDescription": "Started by user Bob the Builder",
                "userId": "bobthebuilder",
                "userName": "Bob the Builder"
            }
        ],
        "duration": "0:00:00",
        "failed_tests": 0,
        "has_results": false,
        "is_good": true,
        "is_running": false,
        "job": "flow",
        "name": "flow #250",
        "parameters": [
            {
                "name": "COMMIT",
                "value": "origin/master"
            },
            {
                "name": "BRANCH",
                "value": "master"
            }
        ],
        "revision": "52926b46bf6b6e7c2bef23cfa5e6ad3a61831a98",
        "skipped_tests": 0,
        "status": "SUCCESS",
        "total_tests": 0,
        "url": "http://jenkins.mydomain.com/job/flow/250"
    },
    "job": "flow"
}
  • Was this article helpful?