pyjen.plugins.freestylejob module

Primitives that manage Jenkins job of type ‘Freestyle’

class pyjen.plugins.freestylejob.FreestyleJob(api)[source]

Bases: pyjen.job.Job

Jenkins job of type ‘freestyle’

Parameters

api (JenkinsAPI) – Pre-initialized connection to the Jenkins REST API

add_builder(builder)[source]

Adds a new build step to this job

Parameters

builder (XMLPlugin) – PyJen plugin describing the build step to add

add_publisher(publisher)[source]

Adds a new job publisher to this job

Parameters

publisher (XMLPlugin) – job publisher to add

property all_downstream_jobs

list of all jobs that depend on this job, recursively

Includes jobs triggered by this job, and all jobs triggered by those jobs, recursively for all downstream dependencies

Type

list (Job)

property all_upstream_jobs

list of all jobs that this job depends on, recursively

Includes jobs that trigger this job, and all jobs trigger those jobs, recursively for all upstream dependencies

Type

list (Job)

property assigned_node

the custom node label restricting which nodes this job can run against

Type

str

property assigned_node_enabled

Checks to see if this job has a custom node restriction

Type

bool

property builders

PyJen plugins that manage the various ‘builders’ for this job

Type

list (XMLPlugin)

property custom_workspace

the custom workspace associated with this job

May return an empty character string if the custom workspace feature is not currently enabled.

Type

str

property custom_workspace_enabled

Checks to see if this job has the custom workspace option enabled

Type

bool

property downstream_jobs

list of jobs to be triggered after this job completes

Type

list (Job)

static get_jenkins_plugin_name()[source]

str: the name of the Jenkins plugin associated with this PyJen plugin

This static method is used by the PyJen plugin API to associate this class with a specific Jenkins plugin, as it is encoded in the config.xml

property publishers

all plugins configured as ‘publishers’ for this job

Type

list (XMLPlugin)

property quiet_period

the delay, in seconds, builds of this job wait in the queue before being run. Returns -1 if there is no custom quiet period for this job

Type

int

property quiet_period_enabled

Checks to see if a custom quiet period is defined on this job

Type

bool

property scm

PyJen plugin describing the source code repository configuration for the job

Type

XMLPlugin

static template_config_xml()[source]
Returns

XML configuration template for instantiating jobs of this type

Return type

str

property upstream_jobs

list of upstream dependencies for this job

Type

list (Job)

class pyjen.plugins.freestylejob.FreestyleXML(api)[source]

Bases: pyjen.utils.jobxml.JobXML

Abstraction around the config.xml for this type of Jenkins job

Parameters

api (JenkinsAPI) – Rest API for the Jenkins XML configuration managed by this object

add_builder(builder)[source]

Adds a new builder node to the build steps section of the job XML

Parameters

builder (XMLPlugin) – PyJen plugin implementing the new job builder to be added

add_publisher(new_publisher)[source]

Adds a new publisher node to the publisher section of the job XML

Parameters

new_publisher (XMLPlugin) – PyJen plugin which supports the Jenkins publisher API

property assigned_node

the build agent label this job is associated with

Type

str

property builders

PyJen plugins that manage the various ‘builders’ for this job

Type

list (XMLPlugin)

property custom_workspace

the local path for the custom workspace associated with this job. Returns None if the custom workspace option is not enabled

Type

str

disable_assigned_node()[source]

Disables a custom node assignment on this job

disable_custom_workspace()[source]

Disables a jobs use of a custom workspace

disable_quiet_period()[source]

Disables custom quiet period on a job

property publishers

0 or more post-build publishers associated with this job. Each element will be an instance of a compatible PyJen plugin for each publisher. Publishers with no valid PyJen plugin installed will be ignored

Type

list (XMLPlugin)

property quiet_period

the delay, in seconds, this job waits in queue before running a build

May return None if no custom quiet period is defined. At the time of this writing the default value is 5 seconds however this may change over time.

Type

int

property scm

Retrieves the appropriate plugin for the SCM portion of a job

Detects which source code management tool is being used by this job, locates the appropriate plugin for that tool, and returns an instance of the wrapper for that plugin pre-configured with the settings found in the relevant XML subtree.

Returns

One of any number of plugin objects responsible for providing extensions to the source code management portion of a job

Example: Subversion Example: GitSCM

Return type

XMLPlugin

pyjen.plugins.freestylejob.PluginClass

alias of pyjen.plugins.freestylejob.FreestyleJob