salt.modules.jenkins module

Module for controlling Jenkins

New in version 2016.3.0.

depends:python-jenkins Python module (not to be confused with jenkins)
configuration:

This module can be used by either passing an api key and version directly or by specifying both in a configuration profile in the salt master/minion config.

For example:

jenkins:
  api_key: peWcBiMOS9HrZG15peWcBiMOS9HrZG15
salt.modules.jenkins.build_job(name=None, parameters=None)

Initiate a build for the provided job.

Parameters:
  • name -- The name of the job is check if it exists.
  • parameters -- Parameters to send to the job.
Returns:

True is successful, otherwise raise an exception.

CLI Example:

salt '*' jenkins.build_job jobname
salt.modules.jenkins.create_job(name=None, config_xml=None, saltenv='base')

Return the configuration file.

Parameters:
  • name -- The name of the job is check if it exists.
  • config_xml -- The configuration file to use to create the job.
  • saltenv -- The environment to look for the file in.
Returns:

The configuration file used for the job.

CLI Example:

salt '*' jenkins.create_job jobname

salt '*' jenkins.create_job jobname config_xml='salt://jenkins/config.xml'
salt.modules.jenkins.delete_job(name=None)

Return true is job is deleted successfully.

Parameters:name -- The name of the job to delete.
Returns:Return true if job is deleted successfully.

CLI Example:

salt '*' jenkins.delete_job jobname
salt.modules.jenkins.disable_job(name=None)

Return true is job is disabled successfully.

Parameters:name -- The name of the job to disable.
Returns:Return true if job is disabled successfully.

CLI Example:

salt '*' jenkins.disable_job jobname
salt.modules.jenkins.enable_job(name=None)

Return true is job is enabled successfully.

Parameters:name -- The name of the job to enable.
Returns:Return true if job is enabled successfully.

CLI Example:

salt '*' jenkins.enable_job jobname
salt.modules.jenkins.get_job_config(name=None)

Return the current job configuration for the provided job.

Parameters:name -- The name of the job to return the configuration for.
Returns:The configuration for the job specified.

CLI Example:

salt '*' jenkins.get_job_config jobname
salt.modules.jenkins.get_job_info(name=None)

Return information about the Jenkins job.

Parameters:name -- The name of the job is check if it exists.
Returns:Information about the Jenkins job.

CLI Example:

salt '*' jenkins.get_job_info jobname
salt.modules.jenkins.get_jobs()

Return the currently configured jobs.

Returns:The currently configured jobs.

CLI Example:

salt '*' jenkins.get_jobs
salt.modules.jenkins.get_version()

Return version of Jenkins

Returns:The version of Jenkins

CLI Example:

salt '*' jenkins.get_version
salt.modules.jenkins.job_exists(name=None)

Check whether the job exists in configured Jenkins jobs.

Parameters:name -- The name of the job is check if it exists.
Returns:True if job exists, False if job does not exist.

CLI Example:

salt '*' jenkins.job_exists jobname
salt.modules.jenkins.job_status(name=None)

Return the current status, enabled or disabled, of the job.

Parameters:name -- The name of the job to return status for
Returns:Return true if enabled or false if disabled.

CLI Example:

salt '*' jenkins.job_status jobname
salt.modules.jenkins.update_job(name=None, config_xml=None, saltenv='base')

Return the updated configuration file.

Parameters:
  • name -- The name of the job is check if it exists.
  • config_xml -- The configuration file to use to create the job.
  • saltenv -- The environment to look for the file in.
Returns:

The configuration file used for the job.

CLI Example:

salt '*' jenkins.update_job jobname

salt '*' jenkins.update_job jobname config_xml='salt://jenkins/config.xml'