pyjen.view module¶
Primitives for interacting with Jenkins views
- class pyjen.view.View(data_io_controller, jenkins_master)[source]¶
Bases: pyjen.utils.plugin_base.PluginBase
‘Abstract’ base class used by all view classes, providing functionality common to them all
Parameters: - data_io_controller (DataRequester) – IO interface which manages interaction with the live Jenkins view
- jenkins_master (Jenkins) – Jenkins instance containing this job
- clone(new_view_name)[source]¶
Make a copy of this view with the specified name
Parameters: new_view_name (str) – name of the newly cloned view Returns: reference to the View object that manages the new, cloned view Return type: View
- clone_all_jobs(source_job_name_pattern, new_job_substring)[source]¶
Batch-clones all jobs contained within this view
Parameters: - source_job_name_pattern (str) – pattern to use as a substitution rule when generating new names for cloned jobs. Substrings within the existing job names that match this pattern will be replaced by the given substitution string
- new_job_substring (str) – character string used to generate new job names for the clones of the existing jobs. The substring of an existing job that matches the given regex will be replaced by this new string to create the new job name for it’s cloned counterpart.
- config_xml[source]¶
Gets the raw configuration data in XML format
This is an advanced function which allows the caller to manually manipulate the raw configuration settings of the view. Use with caution.
This method allows callers to dynamically update arbitrary properties of this view.
Returns: returns the raw XML of the views configuration in a plain text string format Return type: str
- static create(controller, jenkins_master)[source]¶
Factory method used to instantiate the appropriate view type for a given configuration
Parameters: - controller (DataRequester) – IO interface to the Jenkins API. This object is expected to be pre-initialized with the connection parameters for the view to be processed.
- jenkins_master (Jenkins) – Jenkins instance containing this job
Returns: An instance of the appropriate derived type for the given view
Return type:
- delete_all_jobs()[source]¶
Batch method that allows callers to do bulk deletes of all jobs found in this view
- disable_all_jobs()[source]¶
Batch method that allows caller to bulk-disable all jobs found in this view
- enable_all_jobs()[source]¶
Batch method that allows caller to bulk-enable all jobs found in this view
- job_count[source]¶
Gets the number of jobs contained under this view
Returns: number of jobs contained under this view Return type: int
- job_names[source]¶
Gets the list of names of all jobs contained within this view
Returns: the list of names of all jobs contained within this view Return type: list of str
- jobs[source]¶
Gets a list of jobs associated with this view
Views are simply filters to help organize jobs on the Jenkins dashboard. This method returns the set of jobs that meet the requirements of the filter associated with this view.
Returns: list of 0 or more jobs that are included in this view Return type: list of Job objects
- name[source]¶
Gets the display name for this view
This is the name as it appears in the tabbed view of the main Jenkins dashboard
Returns: the name of the view Return type: str
- static supported_types()[source]¶
Returns a list of all view types supported by this instance of PyJen
These view types can be used in such methods as create_view(), which take as input a view type classifier
Returns: list of all view types supported by this instance of PyJen, including those supported by plugins Return type: list of str