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`).

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

Examples

cr_project_set("my-project")
#>  2022-03-26 19:55:42 > ProjectId set to my-project
#> [1] "my-project"
my_gcs_source <- cr_build_source(StorageSource("my_code.tar.gz",
  bucket = "gs://my-bucket"
))
my_gcs_source
#> ==CloudBuildSource==
#> ==CloudBuildStorageSource==
#> bucket:  gs://my-bucket 
#> object:  my_code.tar.gz 

my_repo_source <- cr_build_source(RepoSource("github_username_my-repo.com",
  branchName = "master"
))
my_repo_source
#> ==CloudBuildSource==
#> ==CloudBuildRepoSource==
#> repoName:  github_username_my-repo.com 
#> branchName:  master 
if (FALSE) {

# 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"))
}