REST Resource: projects.builds

Resource: Build

A build resource in the Cloud Build API.

At a high level, a Build describes where to find source code, how to build it (for example, the builder image to run on the source), and where to store the built artifacts.

Fields can include the following variables, which will be expanded when the build is created:

  • $PROJECT_ID: the project ID of the build.
  • $BUILD_ID: the autogenerated ID of the build.
  • $REPO_NAME: the source repository name specified by RepoSource.
  • $BRANCH_NAME: the branch name specified by RepoSource.
  • $TAG_NAME: the tag name specified by RepoSource.
  • $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or resolved from the specified branch or tag.
  • $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA.
JSON representation
{
  "id": string,
  "projectId": string,
  "status": enum (Status),
  "statusDetail": string,
  "source": {
    object (Source)
  },
  "steps": [
    {
      object (BuildStep)
    }
  ],
  "results": {
    object (Results)
  },
  "createTime": string,
  "startTime": string,
  "finishTime": string,
  "timeout": string,
  "images": [
    string
  ],
  "artifacts": {
    object (Artifacts)
  },
  "logsBucket": string,
  "sourceProvenance": {
    object (SourceProvenance)
  },
  "buildTriggerId": string,
  "options": {
    object (BuildOptions)
  },
  "logUrl": string,
  "substitutions": {
    string: string,
    ...
  },
  "tags": [
    string
  ],
  "secrets": [
    {
      object (Secret)
    }
  ],
  "timing": {
    string: {
      object(TimeSpan)
    },
    ...
  }
}
Fields
id

string

Output only. Unique identifier of the build.

projectId

string

Output only. ID of the project.

status

enum (Status)

Output only. Status of the build.

statusDetail

string

Output only. Customer-readable message about the current status.

source

object (Source)

The location of the source files to build.

steps[]

object (BuildStep)

Required. The operations to be performed on the workspace.

results

object (Results)

Output only. Results of the build.

createTime

string (Timestamp format)

Output only. Time at which the request to create the build was received.

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

startTime

string (Timestamp format)

Output only. Time at which execution of the build was started.

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

finishTime

string (Timestamp format)

Output only. Time at which execution of the build was finished.

The difference between finishTime and startTime is the duration of the build's execution.

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

timeout

string (Duration format)

Amount of time that this build should be allowed to run, to second granularity. If this amount of time elapses, work on the build will cease and the build status will be TIMEOUT.

Default time is ten minutes.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

images[]

string

A list of images to be pushed upon the successful completion of all build steps.

The images are pushed using the builder service account's credentials.

The digests of the pushed images will be stored in the Build resource's results field.

If any of the images fail to be pushed, the build status is marked FAILURE.

artifacts

object (Artifacts)

Artifacts produced by the build that should be uploaded upon successful completion of all build steps.

logsBucket

string

Google Cloud Storage bucket where logs should be written (see Bucket Name Requirements). Logs file names will be of the format ${logsBucket}/log-${build_id}.txt.

sourceProvenance

object (SourceProvenance)

Output only. A permanent fixed identifier for source.

buildTriggerId

string

Output only. The ID of the BuildTrigger that triggered this build, if it was triggered automatically.

options

object (BuildOptions)

Special options for this build.

logUrl

string

Output only. URL to logs for this build in Google Cloud Console.

substitutions

map (key: string, value: string)

Substitutions data for Build resource.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

tags[]

string

Tags for annotation of a Build. These are not docker tags.

secrets[]

object (Secret)

Secrets to decrypt using Cloud Key Management Service.

timing

map (key: string, value: object (TimeSpan))

Output only. Stores timing information for phases of the build. Valid keys are:

  • BUILD: time to execute all build steps
  • PUSH: time to push all specified images.
  • FETCHSOURCE: time to fetch source.

If the build does not specify source or images, these keys will not be included.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Methods

cancel

Cancels a build in progress.

create

Starts a build with the specified configuration.

get

Returns information about a previously requested build.

list

Lists previously requested builds.

retry

Creates a new build based on the specified build.

Enviar comentários sobre…