Google Cloud Build V1 Client - Class BuildStep (0.12.0)

Reference documentation and code samples for the Google Cloud Build V1 Client class BuildStep.

A step in the build pipeline.

Generated from protobuf message google.devtools.cloudbuild.v1.BuildStep

Namespace

Google \ Cloud \ Build \ V1

Methods

__construct

Constructor.

Parameters
NameDescription
data array

Optional. Data for populating the Message object.

↳ name string

Required. The name of the container image that will run this particular build step. If the image is available in the host's Docker daemon's cache, it will be run directly. If not, the host will attempt to pull the image first, using the builder service account's credentials if necessary. The Docker daemon's cache will already have the latest versions of all of the officially supported build steps (https://github.com/GoogleCloudPlatform/cloud-builders). The Docker daemon will also have cached many of the layers for some popular images, like "ubuntu", "debian", but they will be refreshed at the time you attempt to use them. If you built an image in a previous build step, it will be stored in the host's Docker daemon's cache and is available to use as the name for a later build step.

↳ env array

A list of environment variable definitions to be used when running a step. The elements are of the form "KEY=VALUE" for the environment variable "KEY" being given the value "VALUE".

↳ args array

A list of arguments that will be presented to the step when it is started. If the image used to run the step's container has an entrypoint, the args are used as arguments to that entrypoint. If the image does not define an entrypoint, the first element in args is used as the entrypoint, and the remainder will be used as arguments.

↳ dir string

Working directory to use when running this step's container. If this value is a relative path, it is relative to the build's working directory. If this value is absolute, it may be outside the build's working directory, in which case the contents of the path may not be persisted across build step executions, unless a volume for that path is specified. If the build specifies a RepoSource with dir and a step with a dir, which specifies an absolute path, the RepoSource dir is ignored for the step's execution.

↳ id string

Unique identifier for this build step, used in wait_for to reference this build step as a dependency.

↳ wait_for array

The ID(s) of the step(s) that this build step depends on. This build step will not start until all the build steps in wait_for have completed successfully. If wait_for is empty, this build step will start when all previous build steps in the Build.Steps list have completed successfully.

↳ entrypoint string

Entrypoint to be used instead of the build step image's default entrypoint. If unset, the image's default entrypoint is used.

↳ secret_env array

A list of environment variables which are encrypted using a Cloud Key Management Service crypto key. These values must be specified in the build's Secret.

↳ volumes array<Google\Cloud\Build\V1\Volume>

List of volumes to mount into the build step. Each volume is created as an empty volume prior to execution of the build step. Upon completion of the build, volumes and their contents are discarded. Using a named volume in only one step is not valid as it is indicative of a build request with an incorrect configuration.

↳ timing Google\Cloud\Build\V1\TimeSpan

Output only. Stores timing information for executing this build step.

↳ pull_timing Google\Cloud\Build\V1\TimeSpan

Output only. Stores timing information for pulling this build step's builder image only.

↳ timeout Google\Protobuf\Duration

Time limit for executing this build step. If not defined, the step has no time limit and will be allowed to continue to run until either it completes or the build itself times out.

↳ status int

Output only. Status of the build step. At this time, build step status is only updated on build completion; step status is not updated in real-time as the build progresses.

↳ allow_failure bool

Allow this build step to fail without failing the entire build. If false, the entire build will fail if this step fails. Otherwise, the build will succeed, but this step will still have a failure status. Error information will be reported in the failure_detail field.

↳ exit_code int

Output only. Return code from running the step.

↳ allow_exit_codes array

Allow this build step to fail without failing the entire build if and only if the exit code is one of the specified codes. If allow_failure is also specified, this field will take precedence.

↳ script string

A shell script to be executed in the step. When script is provided, the user cannot specify the entrypoint or args.

↳ automap_substitutions bool

Option to include built-in and custom substitutions as env variables for this build step. This option will override the global option in BuildOption.

getName

Required. The name of the container image that will run this particular build step.

If the image is available in the host's Docker daemon's cache, it will be run directly. If not, the host will attempt to pull the image first, using the builder service account's credentials if necessary. The Docker daemon's cache will already have the latest versions of all of the officially supported build steps (https://github.com/GoogleCloudPlatform/cloud-builders). The Docker daemon will also have cached many of the layers for some popular images, like "ubuntu", "debian", but they will be refreshed at the time you attempt to use them. If you built an image in a previous build step, it will be stored in the host's Docker daemon's cache and is available to use as the name for a later build step.

Returns
TypeDescription
string

setName

Required. The name of the container image that will run this particular build step.

If the image is available in the host's Docker daemon's cache, it will be run directly. If not, the host will attempt to pull the image first, using the builder service account's credentials if necessary. The Docker daemon's cache will already have the latest versions of all of the officially supported build steps (https://github.com/GoogleCloudPlatform/cloud-builders). The Docker daemon will also have cached many of the layers for some popular images, like "ubuntu", "debian", but they will be refreshed at the time you attempt to use them. If you built an image in a previous build step, it will be stored in the host's Docker daemon's cache and is available to use as the name for a later build step.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getEnv

A list of environment variable definitions to be used when running a step.

The elements are of the form "KEY=VALUE" for the environment variable "KEY" being given the value "VALUE".

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setEnv

A list of environment variable definitions to be used when running a step.

The elements are of the form "KEY=VALUE" for the environment variable "KEY" being given the value "VALUE".

Parameter
NameDescription
var string[]
Returns
TypeDescription
$this

getArgs

A list of arguments that will be presented to the step when it is started.

If the image used to run the step's container has an entrypoint, the args are used as arguments to that entrypoint. If the image does not define an entrypoint, the first element in args is used as the entrypoint, and the remainder will be used as arguments.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setArgs

A list of arguments that will be presented to the step when it is started.

If the image used to run the step's container has an entrypoint, the args are used as arguments to that entrypoint. If the image does not define an entrypoint, the first element in args is used as the entrypoint, and the remainder will be used as arguments.

Parameter
NameDescription
var string[]
Returns
TypeDescription
$this

getDir

Working directory to use when running this step's container.

If this value is a relative path, it is relative to the build's working directory. If this value is absolute, it may be outside the build's working directory, in which case the contents of the path may not be persisted across build step executions, unless a volume for that path is specified. If the build specifies a RepoSource with dir and a step with a dir, which specifies an absolute path, the RepoSource dir is ignored for the step's execution.

Returns
TypeDescription
string

setDir

Working directory to use when running this step's container.

If this value is a relative path, it is relative to the build's working directory. If this value is absolute, it may be outside the build's working directory, in which case the contents of the path may not be persisted across build step executions, unless a volume for that path is specified. If the build specifies a RepoSource with dir and a step with a dir, which specifies an absolute path, the RepoSource dir is ignored for the step's execution.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getId

Unique identifier for this build step, used in wait_for to reference this build step as a dependency.

Returns
TypeDescription
string

setId

Unique identifier for this build step, used in wait_for to reference this build step as a dependency.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getWaitFor

The ID(s) of the step(s) that this build step depends on.

This build step will not start until all the build steps in wait_for have completed successfully. If wait_for is empty, this build step will start when all previous build steps in the Build.Steps list have completed successfully.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setWaitFor

The ID(s) of the step(s) that this build step depends on.

This build step will not start until all the build steps in wait_for have completed successfully. If wait_for is empty, this build step will start when all previous build steps in the Build.Steps list have completed successfully.

Parameter
NameDescription
var string[]
Returns
TypeDescription
$this

getEntrypoint

Entrypoint to be used instead of the build step image's default entrypoint.

If unset, the image's default entrypoint is used.

Returns
TypeDescription
string

setEntrypoint

Entrypoint to be used instead of the build step image's default entrypoint.

If unset, the image's default entrypoint is used.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getSecretEnv

A list of environment variables which are encrypted using a Cloud Key Management Service crypto key. These values must be specified in the build's Secret.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setSecretEnv

A list of environment variables which are encrypted using a Cloud Key Management Service crypto key. These values must be specified in the build's Secret.

Parameter
NameDescription
var string[]
Returns
TypeDescription
$this

getVolumes

List of volumes to mount into the build step.

Each volume is created as an empty volume prior to execution of the build step. Upon completion of the build, volumes and their contents are discarded. Using a named volume in only one step is not valid as it is indicative of a build request with an incorrect configuration.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setVolumes

List of volumes to mount into the build step.

Each volume is created as an empty volume prior to execution of the build step. Upon completion of the build, volumes and their contents are discarded. Using a named volume in only one step is not valid as it is indicative of a build request with an incorrect configuration.

Parameter
NameDescription
var array<Google\Cloud\Build\V1\Volume>
Returns
TypeDescription
$this

getTiming

Output only. Stores timing information for executing this build step.

Returns
TypeDescription
Google\Cloud\Build\V1\TimeSpan|null

hasTiming

clearTiming

setTiming

Output only. Stores timing information for executing this build step.

Parameter
NameDescription
var Google\Cloud\Build\V1\TimeSpan
Returns
TypeDescription
$this

getPullTiming

Output only. Stores timing information for pulling this build step's builder image only.

Returns
TypeDescription
Google\Cloud\Build\V1\TimeSpan|null

hasPullTiming

clearPullTiming

setPullTiming

Output only. Stores timing information for pulling this build step's builder image only.

Parameter
NameDescription
var Google\Cloud\Build\V1\TimeSpan
Returns
TypeDescription
$this

getTimeout

Time limit for executing this build step. If not defined, the step has no time limit and will be allowed to continue to run until either it completes or the build itself times out.

Returns
TypeDescription
Google\Protobuf\Duration|null

hasTimeout

clearTimeout

setTimeout

Time limit for executing this build step. If not defined, the step has no time limit and will be allowed to continue to run until either it completes or the build itself times out.

Parameter
NameDescription
var Google\Protobuf\Duration
Returns
TypeDescription
$this

getStatus

Output only. Status of the build step. At this time, build step status is only updated on build completion; step status is not updated in real-time as the build progresses.

Returns
TypeDescription
int

setStatus

Output only. Status of the build step. At this time, build step status is only updated on build completion; step status is not updated in real-time as the build progresses.

Parameter
NameDescription
var int
Returns
TypeDescription
$this

getAllowFailure

Allow this build step to fail without failing the entire build.

If false, the entire build will fail if this step fails. Otherwise, the build will succeed, but this step will still have a failure status. Error information will be reported in the failure_detail field.

Returns
TypeDescription
bool

setAllowFailure

Allow this build step to fail without failing the entire build.

If false, the entire build will fail if this step fails. Otherwise, the build will succeed, but this step will still have a failure status. Error information will be reported in the failure_detail field.

Parameter
NameDescription
var bool
Returns
TypeDescription
$this

getExitCode

Output only. Return code from running the step.

Returns
TypeDescription
int

setExitCode

Output only. Return code from running the step.

Parameter
NameDescription
var int
Returns
TypeDescription
$this

getAllowExitCodes

Allow this build step to fail without failing the entire build if and only if the exit code is one of the specified codes. If allow_failure is also specified, this field will take precedence.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setAllowExitCodes

Allow this build step to fail without failing the entire build if and only if the exit code is one of the specified codes. If allow_failure is also specified, this field will take precedence.

Parameter
NameDescription
var int[]
Returns
TypeDescription
$this

getScript

A shell script to be executed in the step.

When script is provided, the user cannot specify the entrypoint or args.

Returns
TypeDescription
string

setScript

A shell script to be executed in the step.

When script is provided, the user cannot specify the entrypoint or args.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getAutomapSubstitutions

Option to include built-in and custom substitutions as env variables for this build step. This option will override the global option in BuildOption.

Returns
TypeDescription
bool

hasAutomapSubstitutions

clearAutomapSubstitutions

setAutomapSubstitutions

Option to include built-in and custom substitutions as env variables for this build step. This option will override the global option in BuildOption.

Parameter
NameDescription
var bool
Returns
TypeDescription
$this