Build¶
A Jenkins build represents a single execution of a Jenkins Job.
Builds can be thought of as the second level of the Jenkins hierarchy beneath Jobs. Builds can have state, such as whether they are running or not. They can also have outcomes, such as whether they passed or failed.
Build objects can be associated with Results and Artifacts.
- class jenkinsapi.build.Build(url: str, buildno: int, job: Job, depth: int = 1)[source]¶
Represents a Jenkins build, executed in context of a job.
- get_causes() List[str] [source]¶
Returns a list of causes. There can be multiple causes lists and some of the can be empty. For instance, when a build is manually aborted, Jenkins could add an empty causes list to the actions dict. Empty ones are ignored.
- get_changeset_items()[source]¶
Returns a list of changeSet items.
Each item has structure as in following example: {
- “affectedPaths”: [
“content/rcm/v00-rcm-xccdf.xml”
], “author” : {
“absoluteUrl”: “http://jenkins_url/user/username79”, “fullName”: “username”
}, “commitId”: “3097”, “timestamp”: 1414398423091, “date”: “2014-10-27T08:27:03.091288Z”, “msg”: “commit message”, “paths”: [{
“editType”: “edit”, “file”: “/some/path/of/changed_file”
}], “revision”: 3097, “user”: “username”
}
- get_downstream_builds() List[Build] [source]¶
Get the downstream builds for this build :return List of Build or None
- get_downstream_job_names() List[str] [source]¶
Get the downstream job names for this build :return List of string or None
- get_downstream_jobs() List[Job] [source]¶
Get the downstream jobs for this build :return List of jobs or None
- get_env_vars() Dict[str, str] [source]¶
Return the environment variables.
This method is using the Environment Injector plugin: https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin
- get_estimated_duration() int | None [source]¶
Return the estimated build duration (in seconds) or none.
- get_master_build() 'Build' | None [source]¶
Get the master build if it exist, None otherwise :return Build or None
- get_master_build_number() int | None [source]¶
Get the master build number if it exist, None otherwise :return: int or None
- get_master_job() Job | None [source]¶
Get the master job object if it exist, None otherwise :return: Job or None
- get_master_job_name() str | None [source]¶
Get the master job name if it exist, None otherwise :return: String or None
- get_matrix_runs() Iterator[Build] [source]¶
For a matrix job, get the individual builds for each matrix configuration :return: Generator of Build
- get_params() dict[str, str] [source]¶
Return a dictionary of params names and their values, or an empty dictionary if no parameters are returned.
- get_result_url() str [source]¶
Return the URL for the object which provides the job’s result summary.
- get_resultset() ResultSet [source]¶
Obtain detailed results for this build.
Raises NoResults if the build has no results.
- Returns:
ResultSet
- get_upstream_build() 'Build' | None [source]¶
Get the upstream build if it exist, None otherwise :return Build or None
- get_upstream_build_number() int | None [source]¶
Get the upstream build number if it exist, None otherwise :return: int or None
- get_upstream_job() Job | None [source]¶
Get the upstream job object if it exist, None otherwise :return: Job or None
- get_upstream_job_name() str | None [source]¶
Get the upstream job name if it exist, None otherwise :return: String or None
- is_good() bool [source]¶
Return a bool, true if the build was good. If the build is still running, return False.
- stop() bool [source]¶
Stops the build execution if it’s running :return: boolean True if succeeded False otherwis