cr_buildstep_git: Create a build step for authenticating with Git

View source: R/buildstep_templates_git.R

cr_buildstep_gitsetupR Documentation

Create a build step for authenticating with Git

Description

This creates steps to configure git to use an ssh created key.

This creates steps to use git with an ssh created key.

Usage

cr_buildstep_gitsetup(secret, post_setup = NULL)

cr_buildstep_git(
  git_args = c("clone", "git@github.com:[GIT-USERNAME]/[REPOSITORY]", "."),
  ...
)

git_volume()

Arguments

secret

The name of the secret on Google Secret Manager for the git ssh private key

post_setup

Steps that occur after git setup

git_args

The arguments to send to git

...

Further arguments passed in to cr_buildstep

Details

The ssh private key should be uploaded to Google Secret Manager first

cr_buildstep must come after cr_buildstep_gitsetup

Use git_volume to add the git credentials folder to other buildsteps

See Also

Accessing private GitHub repositories using Cloud Build (google article)

Other Cloud Buildsteps: cr_buildstep_bash(), cr_buildstep_decrypt(), cr_buildstep_df(), cr_buildstep_docker(), cr_buildstep_edit(), cr_buildstep_extract(), cr_buildstep_gcloud(), cr_buildstep_mailgun(), cr_buildstep_nginx_setup(), cr_buildstep_packagetests(), cr_buildstep_pkgdown(), cr_buildstep_run(), cr_buildstep_r(), cr_buildstep_secret(), cr_buildstep_slack(), cr_buildstep_targets(), cr_buildstep()

Examples

cr_project_set("my-project")
cr_bucket_set("my-bucket")

# assumes you have previously saved git ssh key called "github-ssh"
cr_build_yaml(
  steps = c(
    cr_buildstep_gitsetup("github-ssh"),
    cr_buildstep_git(c(
      "clone",
      "git@github.com:github_name/repo_name"
    ))
  )
)

googleCloudRunner documentation built on March 18, 2022, 8 p.m.