This can be written to disk or used directly with functions such as cr_build

cr_build_yaml(
  steps,
  timeout = NULL,
  logsBucket = NULL,
  options = NULL,
  substitutions = NULL,
  tags = NULL,
  secrets = NULL,
  availableSecrets = NULL,
  images = NULL,
  artifacts = NULL,
  serviceAccount = NULL
)

Arguments

steps

A vector of cr_buildstep

timeout

How long the entire build will run. If not set will be 10mins

logsBucket

Where logs are written. If you don't set this field, Cloud Build will use a default bucket to store your build logs.

options

A named list of options

substitutions

Build macros that will replace entries in other elements

tags

Tags for the build

secrets

A secrets object

availableSecrets

What environment arguments from Secret Manager are available to the build - create via cr_build_yaml_secrets

images

What images will be build from this cloudbuild

artifacts

What artifacts may be built from this cloudbuild - create via cr_build_yaml_artifact

serviceAccount

What service account should the build be run under?

Examples

cr_project_set("my-project")
#>  2022-03-26 19:55:47 > ProjectId set to my-project
#> [1] "my-project"
image <- "gcr.io/my-project/my-image"
cr_build_yaml(
  steps = c(
    cr_buildstep("docker", c("build", "-t", image, ".")),
    cr_buildstep("docker", c("push", image)),
    cr_buildstep("gcloud", c("beta", "run", "deploy", "test1", "--image", image))
  ),
  images = image
)
#> ==cloudRunnerYaml==
#> steps:
#> - name: gcr.io/cloud-builders/docker
#>   args:
#>   - build
#>   - -t
#>   - gcr.io/my-project/my-image
#>   - '.'
#> - name: gcr.io/cloud-builders/docker
#>   args:
#>   - push
#>   - gcr.io/my-project/my-image
#> - name: gcr.io/cloud-builders/gcloud
#>   args:
#>   - beta
#>   - run
#>   - deploy
#>   - test1
#>   - --image
#>   - gcr.io/my-project/my-image
#> images:
#> - gcr.io/my-project/my-image