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()
)
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.
A Source object specifying the location of the source files to build, usually created by cr_build_source
Amount of time that this build should be allowed to run, to second
A list of images to be pushed upon the successful completion of all build
Substitutions data for `Build` resource
service account email to be used for the build
Artifacts produced by the build that should be uploaded upon
Special options for this build
ID of the project
Whether to launch the logs URL in a browser once deployed
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()
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"))
}