pyjen.plugins.pipelinejob module

Primitives that manage Jenkins job of type ‘pipeline’

class pyjen.plugins.pipelinejob.PipelineJob(api)[source]

Bases: pyjen.job.Job

Jenkins job of type ‘pipeline’

Parameters

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

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 scm

the source code repo where the job config is defined

Type

XMLPlugin

scm_definition(scm, script_path='Jenkinsfile', lightweight=True)[source]

Defines the Pipeline groovy script used by this job from files stored in a source code repository

Parameters
  • scm (XMLPlugin) – PyJen object defining the source code repository to use

  • script_path (str) – Path within the repository where the groovy script to be run is found. Defaults to ‘Jenkinsfile’ in the root folder

  • lightweight (bool) – Set to True to have the build only check out the Jenkinsfile and no other file from the repository. Set to False to have the build check out the entire repository before running the Jenkinsfile.

property script

the groovy script defining this build

Type

str

script_definition(script, sandbox=True)[source]

Defines the pipeline build using an inline groovy script

Parameters
  • script (str) – Raw Groovy script defining the build process

  • sandbox (bool) – indicates whether the Groovy script can run in the safer ‘sandbox’ environment.

static template_config_xml()[source]
Returns

template XML that can be used to create instances of this class

Return type

str

class pyjen.plugins.pipelinejob.PipelineXML(api)[source]

Bases: pyjen.utils.jobxml.JobXML

Object that manages the config.xml for a pipeline job

Parameters

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

property scm

the source code repo where the build script is located

Type

XMLPlugin

scm_definition(scm, script_path, lightweight)[source]

Defines the Pipeline groovy script used by this job from files stored in a source code repository

Parameters
  • scm (XMLPlugin) – PyJen object defining the source code repository to use

  • script_path (str) – Path within the repository where the groovy script to be run is found.

  • lightweight (bool) – Set to True to have the build only check out the Jenkinsfile and no other file from the repository. Set to False to have the build check out the entire repository before running the Jenkinsfile.

property script

the groovy script that defines the build process for this job

Type

str

script_definition(script, sandbox)[source]

Defines the pipeline build using an inline groovy script

Parameters
  • script (str) – Raw Groovy script defining the build process

  • sandbox (bool) – indicates whether the Groovy script can run in the safer ‘sandbox’ environment.

pyjen.plugins.pipelinejob.PluginClass

alias of pyjen.plugins.pipelinejob.PipelineJob