User API¶
This module is a collection of helpful, high-level functions for automating common tasks. Many of these functions were designed to be exposed to the command-line, hence they have simple string arguments.
- jenkinsapi.api.block_until_complete(jenkinsurl: str, jobs: List[str], maxwait: int = 12000, interval: int = 30, raise_on_timeout: bool = True, username: str = '', password: str = '', ssl_verify: bool = True) None [source]¶
Wait until all of the jobs in the list are complete.
- jenkinsapi.api.get_artifacts(jenkinsurl: str, jobname: str, build_no: int, username: str = '', password: str = '', ssl_verify: bool = True)[source]¶
Find all the artifacts for the latest build of a job.
- jenkinsapi.api.get_build(jenkinsurl: str, jobname: str, build_no: int, username: str = '', password: str = '', ssl_verify: bool = True) Build [source]¶
A convenience function to fetch down the test results from a jenkins job by build number.
- jenkinsapi.api.get_latest_build(jenkinsurl: str, jobname: str, username: str = '', password: str = '', ssl_verify: bool = True) Build [source]¶
A convenience function to fetch down the very latest test results from a jenkins job.
- jenkinsapi.api.get_latest_complete_build(jenkinsurl: str, jobname: str, username: str = '', password: str = '', ssl_verify: bool = True) Build [source]¶
A convenience function to fetch down the very latest test results from a jenkins job.
- jenkinsapi.api.get_latest_test_results(jenkinsurl: str, jobname: str, username: str = '', password: str = '', ssl_verify: bool = True) ResultSet [source]¶
A convenience function to fetch down the very latest test results from a jenkins job.
- jenkinsapi.api.get_nested_view_from_url(url: str, username: str = '', password: str = '', ssl_verify: bool = True) View [source]¶
Returns View based on provided URL. Convenient for nested views.
- jenkinsapi.api.get_view_from_url(url: str, username: str = '', password: str = '', ssl_verify: bool = True) View [source]¶
Factory method
- jenkinsapi.api.grab_artifact(jenkinsurl: str, jobname: str, artifactid, targetdir: str, username: str = '', password: str = '', strict_validation: bool = True, ssl_verify: bool = True) None [source]¶
Convenience method to find the latest good version of an artifact and save it to a target directory. Directory is made automatically if not exists.
- jenkinsapi.api.install_artifacts(artifacts, dirstruct: Dict[str, str], installdir: str, basestaticurl: str, strict_validation: bool = False)[source]¶
Install the artifacts.
- jenkinsapi.api.search_artifact_by_regexp(jenkinsurl: str, jobname: str, artifactRegExp: Pattern, username: str = '', password: str = '', ssl_verify: bool = True) Artifact [source]¶
Search the entire history of a Jenkins job for a build which has an artifact whose name matches a supplied regular expression. Return only that artifact.
@param jenkinsurl: The base URL of the jenkins server @param jobid: The name of the job we are to search through @param artifactRegExp: A compiled regular expression object
(not a re-string)
@param username: Jenkins login user name, optional @param password: Jenkins login password, optional
- jenkinsapi.api.search_artifacts(jenkinsurl: str, jobname: str, artifact_ids=None, username: str = '', password: str = '', ssl_verify: bool = True)[source]¶
Search the entire history of a jenkins job for a list of artifact names. If same_build is true then ensure that all artifacts come from the same build of the job