jenkinsflow.jenkins_api module¶
- class jenkinsflow.jenkins_api.JenkinsApi(direct_uri, job_prefix_filter=None, username=None, password=None, invocation_class=None, rest_access_provider=<class 'jenkinsflow.rest_api_wrapper.RequestsRestApi'>, csrf=True)[source]¶
Optimized minimal set of methods needed for jenkinsflow to access Jenkins jobs.
- Parameters:
direct_uri (str) – Should be a non-proxied uri if possible (e.g. http://localhost:<port> if flow job is running on ‘built-in’ node) The public URI will be retrieved from Jenkins and used in output.
job_prefix_filter (str) – Jobs with names that don’t start with this string, will be skpped when polling Jenkins.
username (str) – Name of user authorized to execute all jobs in flow.
password (str) – Password of user.
invocation_class (class) – Defaults to Invocation. You can subclass that to provide your own class.
csrf (bool) – Will attempt to get (and use) a CSRF protection crumb from Jenkins. A 404 - ResourceNotFound error is silently ignored as this indicates that csrf protection is not enabled on Jenkins.
- set_build_description(description: str, replace: bool = False, separator: str = '\n', build_url: str = None, job_name: str = None, build_number: int = None)[source]¶
Utility to set/append build description.
- Parameters:
description – The description to set on the build
replace – If True, replace existing description, if any, instead of appending to it
separator – A separator to insert between any existing description and the new
descriptionifreplaceis False.build_url – The URL of the Jenkins job build.
job_name – Name of the Jenkins job
build_number – The build number for which to set the description