org.mulesoft

mule-module-jenkins

config

Namespacehttp://www.mulesoft.org/schema/mule/jenkins
Schema Locationhttp://www.mulesoft.org/schema/mule/jenkins/current/mule-jenkins.xsd  (View Schema)
Schema Version1.0
Minimum Mule Version3.2

Module Overview

Provides the ability to interact with Jenkins API REST.

Summary

Configuration
<jenkins:config>
Configure an instance of this module
Message Processors
<jenkins:build>
Perform a job build
<jenkins:build-with-parameters>
Perform a parametrized job build using a map
<jenkins:copy-job>
Create new job using another job as a copy
<jenkins:create-job>
Create new job using basic configuration
<jenkins:delete-job>
Delete job
<jenkins:disable-job>
Disable job
<jenkins:enable-job>
Enable job
<jenkins:get-jenkins-node-info>
Retrieve jenkins server node information
<jenkins:get-job-build-info>
Get job build info
<jenkins:get-job-build-log>
Get job build console log text
<jenkins:get-job-info>
Retrieves Jenkins job information using job name to find it
<jenkins:get-queue-info>
Retrieves Jenkins Queue information, is the current build activity

Configuration

To use the this module within a flow the namespace to the module must be included. The resulting flow will look similar to the following:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jenkins="http://www.mulesoft.org/schema/mule/jenkins"
      xsi:schemaLocation="
               http://www.mulesoft.org/schema/mule/core
               http://www.mulesoft.org/schema/mule/core/current/mule.xsd
               http://www.mulesoft.org/schema/mule/jenkins
               http://www.mulesoft.org/schema/mule/jenkins/current/mule-jenkins.xsd">

      <!-- here goes your flows and configuration elements -->

</mule>

Connection Pool

This connector offers automatic connection management via the use of a connection pool. The pool will act a storage mechanism for all the connections that are in-use by the user of this connector.

Prior to execution of a processor, the connector will attempt to lookup an already established connection and if one doesn't exists it will create one. That lookup mechanism is done in the connection pool via the use of connection variables declared as keys.

The user of the connector can configure the pool by adding a connection-pooling-profile to the connector configuration like this:

    <jenkins:connection-pooling-profile maxActive="10" maxIdle="10"
                             exhaustedAction="WHEN_EXHAUSTED_GROW" maxWait="120" minEvictionMillis="60000" evictionCheckIntervalMillis="30000"/>

The following is a list of connection attributes, each connection attribute can be configured at the config element level or they can also be added to each processor. If they are used at the processor level they get the benefit of full expression resolution.

Connection Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
connectionName A String identification for the connection String */* UTF-8
jenkinsUrl A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8

Reconnection Strategies

Reconnection Strategies specify how a connector behaves when its connection fails. You can control how Mule attempts to reconnect by specifying a number of criteria:

With a reconnection strategy, you can better control the behavior of a failed connection, by configuring it, for example, to re-attempt the connection only once every 15 minutes, and to give up after 30 attempts. You can also send an automatic notification to your IT administrator whenever this reconnection strategy goes into effect. You can even define a strategy that attempts to reconnect only during business hours. Such a setting can prove useful if your server is frequently shut down for nightly maintenance.

Configuration

A reconnection strategy that allows the user to configure how many times a reconnection should be attempted and how long to wait between attempts.

    <jenkins:config>
         <reconnect count="5" frequency="1000"/>
    </jenkins:config>
Reconnect Attributes
NameDefault ValueDescription
frequency 2000 Optional. How often (in ms) to reconnect
count 2 Optional. How many reconnection attempts to make

For more information about reconnection strategies in Mule, or even how to write your own custom reconnection strategy please check this section.

Message Processors

<jenkins:build>

Perform a job build

XML Sample
<jenkins:build jobName="ion-console" />

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
jobName Name of the job to retrieve info String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Exception Payloads
Payload ClassDescription
JenkinsDeploymentException exception

<jenkins:build-with-parameters>

Perform a parametrized job build using a map

XML Sample
<jenkins:build-with-parameters jobName="company-deploy" >
            <jenkins:params>
                <jenkins:param key="version">18</jenkins:param>
                <jenkins:param key="build">233</jenkins:param>
            </jenkins:params>
        </jenkins:build-with-parameters >

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
jobName Name of the job to retrieve info String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Child Elements
NameDefault ValueDescriptionJava Type
<jenkins:params> Build parameters map Map<String, String>
Exception Payloads
Payload ClassDescription
JenkinsDeploymentException exception

<jenkins:copy-job>

Create new job using another job as a copy

XML Sample
<jenkins:copy-job newJobName="JobName" fromJobName="OtherJobName"/>

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
newJobName Name of the job to create String */* UTF-8
fromJobName Name of the job to copy String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Returns
Return Type Description
JobInfo The created Jenkins job info if exits, an empty object if creation failed
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

<jenkins:create-job>

Create new job using basic configuration

XML Sample
<jenkins:create-job jobName="newJobName"/>

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
jobName Name of the job to create String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Returns
Return Type Description
JobInfo The created Jenkins job info if exits, an empty object if creation failed
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

<jenkins:delete-job>

Delete job

XML Sample
<jenkins:delete-job jobName="nJobName"/>

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
jobName Name of the job to delete String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

<jenkins:disable-job>

Disable job

XML Sample
<jenkins:disable-job jobName="JobName"/>

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
jobName Name of the job to disable String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

<jenkins:enable-job>

Enable job

XML Sample
<jenkins:enable-job jobName="JobName"/>

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
jobName Name of the job to enable String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

<jenkins:get-jenkins-node-info>

Retrieve jenkins server node information

XML Sample
<jenkins:get-jenkins-node-info />

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Returns
Return Type Description
JenkinsInfo Jenkins node info
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

<jenkins:get-job-build-info>

Get job build info

XML Sample
<jenkins:get-job-build-info jobName="JobName" buildNumber="1"/>

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
jobName Job name String */* UTF-8
buildNumber Build number int */*
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Returns
Return Type Description
BuildInfo Build info representation object
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

<jenkins:get-job-build-log>

Get job build console log text

XML Sample
<jenkins:get-job-build-log jobName="JobName" buildNumber="1"/>

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
jobName Job name String */* UTF-8
buildNumber Build number String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Returns
Return Type Description
String String with the log output for the requested Job
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

<jenkins:get-job-info>

Retrieves Jenkins job information using job name to find it

XML Sample
<jenkins:get-job-info jobName="jobname" />

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
jobName Name of the job to retrieve info String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Returns
Return Type Description
JobInfo Jenkins job info
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

<jenkins:get-queue-info>

Retrieves Jenkins Queue information, is the current build activity

XML Sample
<jenkins:get-queue-info />

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
connectionName Optional. A String identification for the connection String */* UTF-8
jenkinsUrl Optional. A Jenkins server URL String */* UTF-8
username Optional. Optional String */* UTF-8
password Optional. Optional String */* UTF-8
Returns
Return Type Description
JenkinsQueueInfo Jenkins queue job info
Exception Payloads
Payload ClassDescription
JenkinsConnectorException exception

Message Sources

Transformers