jenkins_jobs package¶
Submodules¶
jenkins_jobs.exceptions module¶
Exceptions that can be generated by the package.
- exception jenkins_jobs.exceptions.InvalidFindTimerTriggerError(original)[source]¶
Bases:
JenkinsJobErrorDescribe a invalid return from the
_find_timer_trigger()method.- __init__(original)[source]¶
Configure the instance.
- Parameters:
original (str) – the error message from the original exception.
:return nothing :rtype None
- __module__ = 'jenkins_jobs.exceptions'¶
- exception jenkins_jobs.exceptions.InvalidXMLConfigError(missing_key)[source]¶
Bases:
JenkinsJobErrorException for XML that does not have the expected structure when being processed.
- __annotations__ = {}¶
- __init__(missing_key)[source]¶
Configure the instance
- Parameters:
missing_key (str) – The missing node on the XML document
- Returns:
nothing
- Return type:
None
- __module__ = 'jenkins_jobs.exceptions'¶
- exception jenkins_jobs.exceptions.JenkinsJobError[source]¶
Bases:
Exception- __annotations__ = {}¶
- __module__ = 'jenkins_jobs.exceptions'¶
- __weakref__¶
list of weak references to the object (if defined)
- exception jenkins_jobs.exceptions.MissingXMLElementError(element, context, job_name)[source]¶
Bases:
JenkinsJobErrorDescribes a missing XML element that is expected to be available in one of the several types of jobs that Jenkins supports.
- __annotations__ = {}¶
- __init__(element, context, job_name)[source]¶
Configure the instance.
- Parameters:
element (str) – the name of the XML element
context (str) – the XML context
job_name (str) – the name of the Jenkins job being processed
- Returns:
nothing
- Return type:
None
- __module__ = 'jenkins_jobs.exceptions'¶
- exception jenkins_jobs.exceptions.NoSchemaSuppliedRESTError[source]¶
Bases:
JenkinsJobErrorException for Jenkins endpoints without a protocol schema.
This exception was created to be raised when validation of Jenkins endpoint URL occurs with any one of the CLIs that are part of the module.
Otherwise, Jenkins will cause an exception with the HTTP client that is harder to understand:
requests.exceptions.MissingSchema: Invalid URL 'crumbIssuer/api/json': No schema supplied. Perhaps you meant http://crumbIssuer/api/json?- __annotations__ = {}¶
- __module__ = 'jenkins_jobs.exceptions'¶
- exception jenkins_jobs.exceptions.UnknownJobTypeError(job_type)[source]¶
Bases:
JenkinsJobErrorException that describe an unexpected job type that cannot be processed.
- __annotations__ = {}¶
- __init__(job_type)[source]¶
Initialize the instance.
- Parameters:
job_type (str) – the name the job type
- Returns:
nothing
- Return type:
None
- __module__ = 'jenkins_jobs.exceptions'¶
jenkins_jobs.exporter module¶
jenkins_jobs.jobs module¶
Main module.
- class jenkins_jobs.jobs.FreestyleJob(name, config)[source]¶
Bases:
JenkinsJobA free style job.
- __abstractmethods__ = frozenset({})¶
- __module__ = 'jenkins_jobs.jobs'¶
- _abc_impl = <_abc._abc_data object>¶
- root_node = 'project'¶
- class jenkins_jobs.jobs.JenkinsJob(name, config)[source]¶
Bases:
ABCBase class for all expected Jenkins job types.
- __abstractmethods__ = frozenset({'_find_desc', '_find_timer_trigger'})¶
- __annotations__ = {}¶
- __dict__ = mappingproxy({'__module__': 'jenkins_jobs.jobs', '__doc__': 'Base class for all expected Jenkins job types.', 'timer_trigger_node': 'hudson.triggers.TimerTrigger', 'default_miss_desc': '*** MISSING DESCRIPTION ***', '__init__': <function JenkinsJob.__init__>, '_find_desc': <function JenkinsJob._find_desc>, '_find_timer_trigger': <function JenkinsJob._find_timer_trigger>, 'one_line_desc': <function JenkinsJob.one_line_desc>, '_clean_spec': <staticmethod(<function JenkinsJob._clean_spec>)>, '__str__': <function JenkinsJob.__str__>, '__dict__': <attribute '__dict__' of 'JenkinsJob' objects>, '__weakref__': <attribute '__weakref__' of 'JenkinsJob' objects>, '__abstractmethods__': frozenset({'_find_desc', '_find_timer_trigger'}), '_abc_impl': <_abc._abc_data object>, '__annotations__': {}})¶
- __init__(name, config)[source]¶
Initialize the instance.
- Parameters:
name (str) – the name of the job
config (dict) – the job configuration
- Returns:
nothing
- Return type:
None
- __module__ = 'jenkins_jobs.jobs'¶
- __str__()[source]¶
String representation of the instance.
- Returns:
a CSV string, using the pipe (“|”) character as separator.
- Return type:
str
- __weakref__¶
list of weak references to the object (if defined)
- _abc_impl = <_abc._abc_data object>¶
- static _clean_spec(timer_spec)[source]¶
Remove unwanted characters that might be part of the timer trigger specification.
- Parameters:
timer_spec (str) – the timer trigger specification
- Returns:
the cleaned timer trigger specification
- Return type:
str
- abstract _find_desc(config)[source]¶
Find the job description.
- Parameters:
config (dict) – the job configuration
- Returns:
the job description
- Return type:
str
- abstract _find_timer_trigger(config)[source]¶
Search for a timer trigger and set the instance.
- Parameters:
config (dict) – the job configuration
- Returns:
an instance of TimerTriggerResult
- Return type:
- default_miss_desc = '*** MISSING DESCRIPTION ***'¶
- one_line_desc()[source]¶
Generate a single line string from the job description.
No parameter is required or expected.
- Returns:
the one line description
- Return type:
str
- timer_trigger_node = 'hudson.triggers.TimerTrigger'¶
- class jenkins_jobs.jobs.MavenJob(name, config)[source]¶
Bases:
PluginBasedJobA job that is based on the Maven plugin.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {}¶
- __module__ = 'jenkins_jobs.jobs'¶
- _abc_impl = <_abc._abc_data object>¶
- root_node = 'maven2-moduleset'¶
- trigger_parent_node = 'triggers'¶
- class jenkins_jobs.jobs.PipelineJob(name, config)[source]¶
Bases:
PluginBasedJobA job that is based on the Pipeline plugin.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {}¶
- __module__ = 'jenkins_jobs.jobs'¶
- _abc_impl = <_abc._abc_data object>¶
- root_node = 'flow-definition'¶
- trigger_grandparent_node = 'org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty'¶
- class jenkins_jobs.jobs.PluginBasedJob(name, config)[source]¶
Bases:
JenkinsJobRepresentation of a Jenkins job that is based on a plugin.
- __abstractmethods__ = frozenset({'_find_timer_trigger'})¶
- __annotations__ = {}¶
- __module__ = 'jenkins_jobs.jobs'¶
- _abc_impl = <_abc._abc_data object>¶
- static _plugin_type(config)[source]¶
Find the plugin type XML node by iterating over the job configuration.
- Param:
dict config: the job configuration
- Returns:
the name of the plugin type
- Return type:
str
- static plugin(config)[source]¶
Retrieve the plugin type name.
- Param:
dict config: the job configuration
- Returns:
the plugin type name, without version information
- Return type:
str
- root_node = None¶
- class jenkins_jobs.jobs.TimerTriggerResult(trigger_based, spec)[source]¶
Bases:
objectRepresentation of a timer trigger search.
A instance of this class must be returned by implementations of the abstract method
JenkinsJob._find_timer_trigger().- __dict__ = mappingproxy({'__module__': 'jenkins_jobs.jobs', '__doc__': 'Representation of a timer trigger search.\n\n A instance of this class must be returned by implementations of the\n abstract method ``JenkinsJob._find_timer_trigger()``.\n ', '__init__': <function TimerTriggerResult.__init__>, 'trigger_spec': <function TimerTriggerResult.trigger_spec>, 'is_defined': <function TimerTriggerResult.is_defined>, '__dict__': <attribute '__dict__' of 'TimerTriggerResult' objects>, '__weakref__': <attribute '__weakref__' of 'TimerTriggerResult' objects>, '__annotations__': {}})¶
- __init__(trigger_based, spec)[source]¶
Initialize a instance.
- Parameters:
trigger_based (bool) – if the job is trigger based or not
spec (str) – the trigger specification
:return nothing :rtype None
- __module__ = 'jenkins_jobs.jobs'¶
- __weakref__¶
list of weak references to the object (if defined)
jenkins_jobs.reporter module¶
jenkins_jobs.retrievers module¶
Module contents¶
Top-level package for Jenkins Jobs.