salt.modules.jenkinsmod

Module for controlling Jenkins

depends

python-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.jenkinsmod.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.jenkinsmod.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.jenkinsmod.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.jenkinsmod.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.jenkinsmod.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.jenkinsmod.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.jenkinsmod.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.jenkinsmod.get_jobs()

Return the currently configured jobs.

Returns

The currently configured jobs.

CLI Example:

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

Return version of Jenkins

Returns

The version of Jenkins

CLI Example:

salt '*' jenkins.get_version
salt.modules.jenkinsmod.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.jenkinsmod.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.jenkinsmod.plugin_installed(name)

New in version 2016.11.0.

Return if the plugin is installed for the provided plugin name.

Parameters

name -- The name of the parameter to confirm installation.

Returns

True if plugin exists, False if plugin does not exist.

CLI Example:

salt '*' jenkins.plugin_installed pluginName
salt.modules.jenkinsmod.run(script)

New in version 2017.7.0.

Execute a script on the jenkins master

Parameters

script -- The script

CLI Example:

salt '*' jenkins.run 'Jenkins.instance.doSafeRestart()'
salt.modules.jenkinsmod.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'