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’

add_builder(builder)[source]

Adds a new build step to this job

Parameters

builder – build step config to add

add_publisher(publisher)[source]

Adds a new job publisher to this job

Parameters

publisher – job publisher to add

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

Returns

A list of 0 or more jobs which depend on this one

Return type

list of Job objects

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

Returns

A list of 0 or more jobs this job depend on

Return type

list of Job objects

assigned_node

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

Return type

str

assigned_node_enabled

Checks to see if this job has a custom node restriction

Return type

bool

builders

Gets all plugins configured as ‘builders’ for this job

custom_workspace

gets the custom workspace associated with this job

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

Return type

str

custom_workspace_enabled

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

Return type

bool

downstream_jobs

Gets the list of jobs to be triggered after this job completes

Returns

A list of 0 or more jobs which depend on this one

Return type

list of Job objects

static get_jenkins_plugin_name()[source]

Gets 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

Return type

str

publishers

Gets all plugins configured as ‘publishers’ for this job

quiet_period
Returns

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

Return type

int

quiet_period_enabled

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

Return type

bool

scm

Gets the source code repository configuration from the job config

static template_config_xml()[source]

XML configuration template for instantiating jobs of this type

Returns

a basic XML configuration template for use when instantiating jobs of this type

Return type

str

upstream_jobs

Gets the list of upstream dependencies for this job

Returns

A list of 0 or more jobs that this job depends on

Return type

list of Job objects

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

Bases: pyjen.utils.jobxml.JobXML

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

add_builder(builder)[source]

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

Parameters

builder – 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 – PyJen plugin which supports the Jenkins publisher API

assigned_node

Gets the build agent label this job is associated with

Returns

the build agent label this job is associated with

Return type

str

builders

Gets a list of 0 or more build operations associated with this job

Returns

a list of build operations associated with this job

Return type

list of builder plugins used by this job

custom_workspace

Gets the local path for the custom workspace associated with this job

returns None if the custom workspace option is not enabled :rtype: 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

publishers

list of 0 or more post-build publishers associated with this job

Returns

a list of post-build publishers associated with this job

Return type

list of publisher plugins supported by this job

quiet_period

Gets 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.

Return type

int

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

Examples: Subversion

Return type

PluginBase

pyjen.plugins.freestylejob.PluginClass

alias of pyjen.plugins.freestylejob.FreestyleJob