Build¶
A jenkins build represents a single execution of a Jenkins Job.
Builds can be thought of as the second level of the jenkins heirarchy beneath Jobs. Builds can have state, such as whether they are running or not. They can also have outcomes, such as wether they passed or failed.
Build objects can be associated with Results and Artifacts.g
-
class
jenkinsapi.build.
Build
(url, buildno, job, depth=1)¶ Represents a jenkins build, executed in context of a job.
-
get_causes
()¶ 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
()¶ 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_console
()¶ Return the current state of the text console.
-
get_downstream_builds
()¶ Get the downstream builds for this build :return List of Build or None
-
get_downstream_job_names
()¶ Get the downstream job names for this build :return List of string or None
-
get_downstream_jobs
()¶ Get the downstream jobs for this build :return List of jobs or None
-
get_env_vars
()¶ Return the environment variables.
This method is using the Environment Injector plugin: https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin
-
get_master_build
()¶ Get the master build if it exist, None otherwise :return Build or None
-
get_master_build_number
()¶ Get the master build number if it exist, None otherwise :return: int or None
-
get_master_job
()¶ Get the master job object if it exist, None otherwise :return: Job or None
-
get_master_job_name
()¶ Get the master job name if it exist, None otherwise :return: String or None
-
get_matrix_runs
()¶ For a matrix job, get the individual builds for each matrix configuration :return: Generator of Build
-
get_params
()¶ Return a dictionary of params names and their values or None if no parameters present
-
get_result_url
()¶ Return the URL for the object which provides the job’s result summary.
-
get_resultset
()¶ Obtain detailed results for this build.
-
get_timestamp
()¶ Returns build timestamp in UTC
-
get_upstream_build
()¶ Get the upstream build if it exist, None otherwise :return Build or None
-
get_upstream_build_number
()¶ Get the upstream build number if it exist, None otherwise :return: int or None
-
get_upstream_job
()¶ Get the upstream job object if it exist, None otherwise :return: Job or None
-
get_upstream_job_name
()¶ Get the upstream job name if it exist, None otherwise :return: String or None
-
has_resultset
()¶ Return a boolean, true if a result set is available. false if not.
-
is_good
()¶ Return a bool, true if the build was good. If the build is still running, return False.
-
is_running
()¶ Return a bool if running.
-
stop
()¶ Stops the build execution if it’s running :return boolean True if succeded False otherwise or the build
is not running
-