Helper to run a supplied bash script, that will be copied in-line

cr_buildstep_bash(
  bash_script,
  name = "ubuntu",
  bash_source = c("local", "runtime"),
  escape_dollar = TRUE,
  ...
)

Arguments

bash_script

bash code to run or a filepath to a file containing bash code that ends with .bash or .sh

name

The image that will run the R code

bash_source

Whether the code will be from a runtime file within the source or at build time copying over from a local file in your session

escape_dollar

Default TRUE. This will turn $ into $$ within the script to avoid them being recognised as Cloud Build variables. Turn this off if you want that behaviour (e.g. my_project="$PROJECT_ID")

...

Other arguments passed to cr_buildstep

Details

If you need to escape build parameters in bash scripts, you need to escape CloudBuild's substitution via $$ and bash's substitution via \$ e.g. \$$PARAM

Examples

cr_project_set("my-project")
#>  2022-03-26 19:55:48 > ProjectId set to my-project
#> [1] "my-project"
bs <- cr_build_yaml(
  steps = cr_buildstep_bash("echo 'Hello'")
)
if (FALSE) {
cr_build(bs)
}