R/buildsteps_templates.R
cr_buildstep_slack.RdThis uses https://github.com/technosophos/slack-notify to send Slack messages
cr_buildstep_slack( message, title = "CloudBuild - $BUILD_ID", channel = NULL, username = "googleCloudRunnerBot", webhook = "$_SLACK_WEBHOOK", icon = NULL, colour = "#efefef" )
| message | The body of the message |
|---|---|
| title | The title of the message |
| channel | The channel to send the message to (if omitted, use Slack-configured default) |
| username | The name of the sender of the message. Does not need to be a "real" username |
| webhook | The Slack webhook to send to |
| icon | A URL to an icon (squares between 512px and 2000px) |
| colour | The RGB colour for message formatting |
You will need to set up a Slack webhook first, via this Slack guide on using incoming webhooks.
Once set, the default is to set this webhook to a Build macro called _SLACK_WEBHOOK, or supply it to the webhook argument.
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_gitsetup(),
cr_buildstep_mailgun(),
cr_buildstep_nginx_setup(),
cr_buildstep_pkgdown(),
cr_buildstep_run(),
cr_buildstep_r(),
cr_buildstep_secret(),
cr_buildstep()
# send a message to googleAuthRverse Slack webhook <- "https://hooks.slack.com/services/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" cr_buildstep_slack("Hello Slack", webhook = webhook)#> [[1]] #> ==cloudRunnerBuildStep== #> name: technosophos/slack-notify #> env: #> - SLACK_WEBHOOK=https://hooks.slack.com/services/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 #> - SLACK_MESSAGE='Hello Slack' #> - SLACK_TITLE='CloudBuild - $BUILD_ID' #> - SLACK_COLOR='#efefef' #> - SLACK_USERNAME='googleCloudRunnerBot' #>if (FALSE) { bs <- cr_build_yaml(steps = cr_buildstep_slack("Hello Slack")) cr_build(bs, substitutions = list(`_SLACK_WEBHOOK` = webhook)) }