Module for controlling Jenkins
python-jenkins
New in version 2016.3.0.
python-jenkins Python module (not to be confused with jenkins)
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.
name -- The name of the job is check if it exists.
parameters -- Parameters to send to the job.
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.
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.
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.
name -- The name of the job to delete.
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.
name -- The name of the job to disable.
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.
name -- The name of the job to enable.
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.
name -- The name of the job to return the configuration for.
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.
name -- The name of the job is check if it exists.
Information about the Jenkins job.
CLI Example:
salt '*' jenkins.get_job_info jobname
salt.modules.jenkinsmod.
get_jobs
()¶Return the currently configured jobs.
The currently configured jobs.
CLI Example:
salt '*' jenkins.get_jobs
salt.modules.jenkinsmod.
get_version
()¶Return version of Jenkins
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.
name -- The name of the job is check if it exists.
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.
name -- The name of the job to return status for
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.
name -- The name of the parameter to confirm installation.
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
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.
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.
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'