jenkinsflow.jenkins_api module¶
-
class
jenkinsflow.jenkins_api.
Jenkins
(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 master) 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. If you are using Hudson and have many jobs, it might be a good idea to enable Team support and create a job-runner user, which only has access to the jobs in the flow that it is executing. That way the job list will be filtered serverside.
- 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
description
ifreplace
is 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