cr_build: Starts a build with the specified configuration.

View source: R/build_do.R

cr_buildR Documentation

Starts a build with the specified configuration.

Description

This method returns a long-running 'Operation', which includes the buildID. Pass the build ID to cr_build_status to determine the build status (such as 'SUCCESS' or 'FAILURE').

Usage

cr_build(
  x,
  source = NULL,
  timeout = NULL,
  images = NULL,
  substitutions = NULL,
  serviceAccount = NULL,
  artifacts = NULL,
  options = NULL,
  projectId = cr_project_get(),
  launch_browser = interactive()
)

Arguments

x

A cloudbuild.yaml file location or an R object that will be turned into yaml via as.yaml or a Build object created by cr_build_make or from a previous build you want to rerun.

source

A Source object specifying the location of the source files to build, usually created by cr_build_source

timeout

Amount of time that this build should be allowed to run, to second

images

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

substitutions

Substitutions data for 'Build' resource

serviceAccount

service account email to be used for the build

artifacts

Artifacts produced by the build that should be uploaded upon

options

Special options for this build

projectId

ID of the project

launch_browser

Whether to launch the logs URL in a browser once deployed

See Also

Google Documentation for Cloud Build

Other Cloud Build functions: Build(), RepoSource(), Source(), StorageSource(), cr_build_artifacts(), cr_build_list(), cr_build_logs(), cr_build_make(), cr_build_status(), cr_build_targets(), cr_build_upload_gcs(), cr_build_wait(), cr_build_write(), cr_build_yaml_artifact(), cr_build_yaml_secrets(), cr_build_yaml()

Examples

cr_project_set("my-project")
my_gcs_source <- cr_build_source(StorageSource("my_code.tar.gz",
  bucket = "gs://my-bucket"
))
my_gcs_source

my_repo_source <- cr_build_source(RepoSource("github_username_my-repo.com",
  branchName = "master"
))
my_repo_source
## Not run: 

# build from a cloudbuild.yaml file
cloudbuild_file <- system.file("cloudbuild/cloudbuild.yaml",
  package = "googleCloudRunner"
)

# asynchronous, will launch log browser by default
b1 <- cr_build(cloudbuild_file)

# synchronous waiting for build to finish
b2 <- cr_build_wait(b1)

# the same results
cr_build_status(b1)
cr_build_status(b2)

# build from a cloud storage source
build1 <- cr_build(cloudbuild_file,
  source = my_gcs_source
)
# build from a git repository source
build2 <- cr_build(cloudbuild_file,
  source = my_repo_source
)

# you can send in results for previous builds to trigger
# the same build under a new Id
# will trigger build2 again
cr_build(build2)

# a build with substitutions (Cloud Build macros)
cr_build(build2, substitutions = list(`_SUB` = "yo"))

## End(Not run)

googleCloudRunner documentation built on March 18, 2022, 8 p.m.