Learn R Programming

googleCloudRunner (version 0.2.0)

cr_buildtrigger: Creates a new `BuildTrigger`.This API is experimental.

Description

Creates a new `BuildTrigger`.This API is experimental.

Usage

cr_buildtrigger(
  name,
  trigger,
  build,
  description = paste("cr_buildtrigger: ", Sys.time()),
  tags = NULL,
  disabled = FALSE,
  substitutions = NULL,
  ignoredFiles = NULL,
  includedFiles = NULL,
  projectId = cr_project_get()
)

Arguments

name

User assigned name of the trigger

trigger

The trigger source which will be a RepoSource or a GitHubEventsConfig

build

A file location within the trigger source to use for the build steps, or a Build object

description

Human-readable description of this trigger

tags

Tags for annotation of a `BuildTrigger`

disabled

If true, the trigger will never result in a build

substitutions

A named list of Build macro variables

ignoredFiles

ignored_files and included_files are file glob matches extended with support for "**".

includedFiles

If any of the files altered in the commit pass the ignored_files

projectId

ID of the project for which to configure automatic builds

See Also

Other BuildTrigger functions: BuildTrigger(), GitHubEventsConfig(), cr_buildtrigger_delete(), cr_buildtrigger_edit(), cr_buildtrigger_get(), cr_buildtrigger_list(), cr_buildtrigger_make(), cr_buildtrigger_run()

Examples

Run this code
# NOT RUN {
cr_project_set("my-project")
cr_bucket_set("my-bucket")
cloudbuild <- system.file("cloudbuild/cloudbuild.yaml",
                           package = "googleCloudRunner")
bb <- cr_build_make(cloudbuild)
github <- GitHubEventsConfig("MarkEdmondson1234/googleCloudRunner",
                             branch = "master")
# creates a trigger with named subtitutions
ss <- list(`_MYVAR` = "TEST1",
           `_GITHUB` = "MarkEdmondson1234/googleCloudRunner")

# }
# NOT RUN {
cr_buildtrigger("trig1", trigger = github, build = bb)

cr_buildtrigger("trig2", trigger = github,
                build = bb,
                substitutions = ss)

# create a trigger that will build from the file in the repo
# this is similar to what cr_deploy_docker_github() does
cr_buildtrigger("trig3", trigger = github,
                build = "inst/cloudbuild/cloudbuild.yaml")

build_docker <- cr_build_make(
                    cr_build_yaml(
                      steps = cr_buildstep_docker("build-dockerfile"),
                      images = "gcr.io/my-project/my-image"
                    ))

cr_buildtrigger("trig4", trigger = github,
                 build = build_docker)
# }

Run the code above in your browser using DataLab