jenkinsflow.script_api module¶
-
class
jenkinsflow.script_api.
Jenkins
(direct_uri, job_prefix_filter=None, username=None, password=None, invocation_class=None, log_dir=None, **kwargs)[source]¶ Optimized minimal set of methods needed for jenkinsflow to directly execute python code instead of invoking Jenkins jobs.
THIS DOES NOT SUPPORT CONCURRENT INVOCATIONS OF FLOW
There is no concept of job queues or executors, so if your flow depends on these for correctness, you wil experience different behaviour when using this api instead of the real Jenkins.
Parameters: - direct_uri (str) –
Path to dir with ‘job’ method python modules. Modules named <job-name>.py will be imported from this directory. If no module exists for a specific jobname, the module called ‘default.py’ will be imported. The modules must contain at method called ‘run_job’ with the following signature:
run_job(job_name, job_prefix_filter, username, password, securitytoken, cause, build_params)A return value of 0 is ‘SUCCESS’ A return value of 1 or any exception raised is ‘FAILURE’ Other return values means ‘UNSTABLE’
- job_prefix_filter (str) – Passed to ‘run_job’.
jenkinsflow
puts no meaning into this parameter. - username (str) – Passed to ‘run_job’.
jenkinsflow
puts no meaning into this parameter. - password (str) – Passed to ‘run_job’.
jenkinsflow
puts no meaning into this parameter. - invocation_class (class) – Defaults to Invocation.
- log_dir (str) – Directory in which to store logs. Defaults to subdirectory ‘jenkinsflow’ under the system defined tmp dir.
- **kwargs – Ignored for compatibility with the other jenkins apis
-
set_build_description
(description, replace=False, separator='\n', job_name=None, build_number=None)[source]¶ Utility to set/append build description.
description
will be written to a file in the workspace.Parameters: - description (str) – The description to set on the build.
- append (bool) – If True append to existing description, if any.
- separator (str) – A separator to insert between any existing description and the new
description
ifappend
is True. - job_name (str) –
- build_number (int) –
- direct_uri (str) –