Jenkins currentBuild: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 6: Line 6:


=Properties=
=Properties=
==<tt>number</tt>==
====<tt>number</tt>====
The build number, which is an integer.
The build number, which is an integer.
==<tt>result</tt>==
====<tt>result</tt>====
Typically "SUCCESS", "UNSTABLE" or "FAILURE". May be null for an ongoing build. The property is writable.
Typically "SUCCESS", "UNSTABLE" or "FAILURE". May be null for an ongoing build. The property is writable.
==<tt>currentResult</tt>==
==<tt>currentResult</tt>==
Typically "SUCCESS", "UNSTABLE" or "FAILURE". Is never null. If no failure occurred, the result is "SUCCESS".
Typically "SUCCESS", "UNSTABLE" or "FAILURE". Is never null. If no failure occurred, the result is "SUCCESS".
 
====<tt>displayName</tt>====
==<tt>displayName</tt>==
Normally "#<[[#number|number]]>". The property is writable.
Normally "#<[[#number|number]]>".
====<tt>fullDisplayName</tt>====
 
==<tt>fullDisplayName</tt>==
Normally folder1 > folder2 > something #123.
Normally folder1 > folder2 > something #123.
====<tt>projectName</tt>====
Name of the project (pipeline) of this build.
====<tt>fullProjectName</tt>====
Full name of the project of this build, including folders such as folder1/folder2/something.
====<tt>description</tt>====
Additional information about the build. The property is writable.
====<tt>id</tt>====
Normally the build [[#number|number]] as a string.
====<tt>timeInMillis</tt>====
Time since the epoch when the build was scheduled.
====<tt>startTimeInMillis</tt>====
Time since the epoch when the build started running.
====<tt>duration</tt>====
Duration of the build in milliseconds.
====<tt>durationString</tt>====
A human-readable representation of the build duration.
====<tt>previousBuild</tt>====
Previous build of the project, or null.
====<tt>previousBuildInProgress</tt>====
Previous build of the project that is currently building, or null.
====<tt>previousBuiltBuild</tt>====
Previous build of the project that has been built (may be currently building), or null.
====<tt>previousCompletedBuild</tt>====
Previous build of the project that has last finished building, or null.
====<tt>previousFailedBuild</tt>====
Previous build of the project that has last failed to build, or null.
====<tt>previousNotFailedBuild</tt>====
Previous build of the project that did not fail to build (eg. result is successful or unstable), or null.
====<tt>previousSuccessfulBuild</tt>====
Previous build of the project that has successfully built, or null.
====<tt>nextBuild</tt>====
Next build of the project, or null.
====<tt>absoluteUrl</tt>====
URL of build index page.
====<tt>buildVariables</tt>====
For a non-Pipeline downstream build, offers access to a map of defined build variables. For a Pipeline downstream build, any variables set globally on env at the time the build ends. Child Pipeline jobs can use this to report additional information to the parent job by setting variables in env. Note that build parameters are not shown in buildVariables.
====<tt>changeSets</tt>====
====<tt>upstreamBuilds</tt>====
====<tt>rawBuild</tt>====
====<tt>keepLog</tt>====
True if the log file for this build should be kept and not deleted. The property is writable.


==<tt></tt>==
==<tt></tt>==
==<tt></tt>==
==<tt></tt>==
==<tt></tt>==
==<tt></tt>==
==<tt></tt>==
==<tt></tt>==
==<tt></tt>==
==<tt></tt>==
==<tt></tt>==
=Methods=
=Methods=
==<tt>resultIsBetterOrEqualTo(String)</tt>==
==<tt>resultIsBetterOrEqualTo(String)</tt>==

Revision as of 04:43, 8 May 2021

Internal

Overview

currentBuild is a global variable that may be used to refer to the currently running build. It has the following properties and methods.

Properties

number

The build number, which is an integer.

result

Typically "SUCCESS", "UNSTABLE" or "FAILURE". May be null for an ongoing build. The property is writable.

currentResult

Typically "SUCCESS", "UNSTABLE" or "FAILURE". Is never null. If no failure occurred, the result is "SUCCESS".

displayName

Normally "#<number>". The property is writable.

fullDisplayName

Normally folder1 > folder2 > something #123.

projectName

Name of the project (pipeline) of this build.

fullProjectName

Full name of the project of this build, including folders such as folder1/folder2/something.

description

Additional information about the build. The property is writable.

id

Normally the build number as a string.

timeInMillis

Time since the epoch when the build was scheduled.

startTimeInMillis

Time since the epoch when the build started running.

duration

Duration of the build in milliseconds.

durationString

A human-readable representation of the build duration.

previousBuild

Previous build of the project, or null.

previousBuildInProgress

Previous build of the project that is currently building, or null.

previousBuiltBuild

Previous build of the project that has been built (may be currently building), or null.

previousCompletedBuild

Previous build of the project that has last finished building, or null.

previousFailedBuild

Previous build of the project that has last failed to build, or null.

previousNotFailedBuild

Previous build of the project that did not fail to build (eg. result is successful or unstable), or null.

previousSuccessfulBuild

Previous build of the project that has successfully built, or null.

nextBuild

Next build of the project, or null.

absoluteUrl

URL of build index page.

buildVariables

For a non-Pipeline downstream build, offers access to a map of defined build variables. For a Pipeline downstream build, any variables set globally on env at the time the build ends. Child Pipeline jobs can use this to report additional information to the parent job by setting variables in env. Note that build parameters are not shown in buildVariables.

changeSets

upstreamBuilds

rawBuild

keepLog

True if the log file for this build should be kept and not deleted. The property is writable.

Methods

resultIsBetterOrEqualTo(String)

Compares the current build result to the provided result string (SUCCESS, UNSTABLE, or FAILURE) and returns true if the current build result is better than or equal to the provided result.

resultIsWorseOrEqualTo(String)

Compares the current build result to the provided result string (SUCCESS, UNSTABLE, or FAILURE) and returns true if the current build result is worse than or equal to the provided result.