cr_build_yaml_secrets: Create an availableSecrets entry for build yaml

View source: R/yaml.R

cr_build_yaml_secretsR Documentation

Create an availableSecrets entry for build yaml

Description

This creates the availabelSecrets entry for Builds so they can use Secret Manager environment arguments in the builds.

Usage

cr_build_yaml_secrets(
  secretEnv,
  secret,
  version = "latest",
  projectId = cr_project_get()
)

Arguments

secretEnv

The name of the secretEnv that will be referred to in the build steps e.g. 'GH_TOKEN'

secret

The secret data name in Secret Manager

version

The version of the secret

projectId

The project to get the Secret from

See Also

To download from Secret Manager to a file in a dedicated buildstep see cr_buildstep_secret.

Using secrets from Secret Manager

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(), cr_build()

Examples


cr_build_yaml_secrets("GH_TOKEN", "github_token")

s1 <- cr_build_yaml_secrets("USERNAME", "my_username")
s2 <- cr_build_yaml_secrets("PASSWORD", "my_password")

# use one $ in scripts to use the secretEnv (will be replaced by $$)
cr_build_yaml(
  steps = cr_buildstep(
    "docker",
    entrypoint = "bash",
    args = c(
      "-c",
      "docker login --username=$USERNAME --password=$PASSWORD"
    ),
    secretEnv = c("USERNAME", "PASSWORD")
  ),
  availableSecrets = list(s1, s2)
)

MarkEdmondson1234/googleCloudRunner documentation built on Feb. 5, 2023, 5:45 p.m.