Skip to main content
System StatusContact Support
VersionOne Community

Configuring the Jenkins Plugin

Overview 

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

Configuration

Before using the Jenkins plugin, you must set up one or more Jenkins instances.

  1. Select Plugins from the Administration menu (cogwheel icon) and select  Jenkins from the list of plugins available. 
  2. Click Add and enter the following information:
    • Name: Type a name for the Jenkins instance. 
    • User and Password: Type the username and password that should be used to log on to the Jenkins server. Leave blank if no authentication is required. 
    • Token: Type the authentication token to connect to the Jenkins server. Authentication token, when used, takes precedence over the username and password for validation. Do not use both the username/password and the token at the same time. 
    • URL: Type the URL of the Jenkins server. 
  3. Click Test Connection and make sure you are able to connect to the Jenkins server successfully.
  4. Repeat steps 2 and 3 to add more instances.

 

Using the Jenkins Plugin

Once one or more Jenkins instances have been set up, you can set up pipelines that use the Jenkins plugin. 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

There are four functions available with the Jenkins plugin, which you can use in your Pipelines. 

  • Build: Used to trigger a build of a specified Jenkins job. 
  • Get Build Info: Used to get the build information (running or completed).
  • Read Workspace File: Used to read a Jenkins workspace file and save the information in a Pipeline instance's workspace. 
  • Get URL: Used to get and save the response from a Jenkins URL into a Pipeline instance's workspace. 

Build

The Build function triggers 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 Name - (required) The Jenkins job name.
  • Parameters  Parameters that are passed to the Jenkins job in JSON format.  For example:
{
 "BRANCH": "[$ git['ref'] $]",
 "COMMIT": "[$ git['after'] $]",
 "NOTE": "This job was triggered by VersionOne Continuum Flow"
}

Regarding Parameters: Many versions of Jenkins are strict about the definition of parameters in the Jenkins job definition.  Intuitively, a Job with defined parameters will not start if the Plugin does not provide parameters.  Strangely, however, a Job that does not have parameters defined will actually refuse to be started if the Plugin does provide parameters.  So, take care that the Jenkins job definition and the Build Plugin match in regards to parameters.

  • Wait - (true/false) Whether or not to wait on the Job to complete. The default is 'true'.
  • Inherit Job Status - (true/false) Whether or not to inherit the build status (success/failure). The default is 'true'.
  • Regular Expression - A regular expression that is used to search the log. 
  • Value to Set - A value to set in the Pipeline instance's workspace from the regular expression search. 
  • Jenkins Instance Name - The name of the Jenkins instance where the build is triggered. 
  • Result Key - A name (workspace key) that is used to receive the result of this function.

 

Get Build Info

The Get Build Info function is used to get the build status information ("success" or "failure"). This function is typically useful when you want to bring back and store the data from a Jenkins job in Continuum as a permanent record and it allows you to see the test information and even the logs inside Continuum.

Properties

  • Job Name - (required) The Jenkins job name.
  • Build Number - (required) The Jenkins build number.
  • Wait - (true/false) Whether or not to wait on the Job to complete. The default is 'true'.
  • Inherit Job Status - (true/false) Whether or not to inherit the build status (success/failure). The default is 'true'.
  • Regular Expression - A regular expression that is used to search the log. 
  • Value to Set - A value to set in the Pipeline instance's workspace from the regular expression search. 
  • Jenkins Instance Name - The name of the Jenkins instance where the build is triggered. 
  • Result Key - A name (workspace key) that is used to receive the result of this function.

 

Read Workspace File

The Read Workspace File function is used to read a Jenkins workspace file and save the information in a Pipeline instance's workspace.

 

Properties

  • Job - (required) The Jenkins job name.
  • Path - Path to the file in the Jenkins workspace. Include the path only, do not include the server name.
  • Target - A key to be set with the workspace file contents. 
  • Instance Name - The name of the Jenkins instance where the workspace file is. 

 

Get URL

The Get URL function is used to get and save the response from a Jenkins URL into a Pipeline instance's workspace.

Properties

  • Path - The Jenkins URL to get the response from. 
  • Target - A key to be set with the parse results.
  • Jenkins Instance Name - The name of the Jenkins instance.

 

Phase Data

The Jenkins plugin saves the job and build values on the phasedata section of the Pipeline instance's workspace. Additionally, a fairly consistent set of data is also saved. (May vary depending on the Jenkins version.) Here's an example of the phase data saved from a typical Pipeline instance.

 

jenkinsphasedata.png

  • Was this article helpful?