Triggering pipelines

Pipelines in Buddy can be triggered in three different ways:

  1. Manually – on click via Buddy's website
  2. Automatically – on every push to the repository
  3. Recurrently – on a time interval

If you are looking for info on how to trigger pipelines at a specific time, check out this article.

Apart from that, pipelines can also be triggered using:

  1. Webhooks
  2. REST API
  3. Commit commands
  4. Slack commands

Webhooks

If you want to trigger your pipeline with a webhook, go to the pipeline settings and click 'Webhook URL' in the right menu. A box will appear with a URL that can be used to run the pipeline from a remote service: HTTP Request

By default, every request will trigger an execution to the HEAD revision in the branch. Optionally, you can send some parameters to customize the execution. These parameters can be sent either in a URL query, or as POST parameters.

Parameters

Run to revision revision=38ebd0cc80895dadbf0e8c3d667123630f64ec6a (example)

Upload from scratch fromScratch=1

Clear cache clearCache=1

Comment comment=my%20comment

Branch (for wildcard pipeline) branch=dev

Tag (for wildcard pipeline) tag=mytag

Custom ENV VARs myenv=value

Examples

HTTP GET with parameters in query:

GET
https://app.buddy.works/buddyworks/buddy-demo/pipelines/pipeline/189325/trigger-webhook?token=98a7a230afe6827ba8a2cd1e96c626ba6b0d0e289a25ef9094129bc28d02763f703bfea3d8e37fe2dabe61875b242f51&revision=38ebd0cc80895dadbf0e8c3d667123630f64ec6a

HTTP POST with Content-Type: application/json

POST
https://app.buddy.works/buddyworks/buddy-demo/pipelines/pipeline/189325/trigger-webhook?token=98a7a230afe6827ba8a2cd1e96c626ba6b0d0e289a25ef9094129bc28d02763f703bfea3d8e37fe2dabe61875b242f51
{
"comment": "my comment",
"clearCache": 1,
"env1": "env value"
}

HTTP POST with Content-Type: application/x-www-form-urlencoded

POST
https://app.buddy.works/buddyworks/buddy-demo/pipelines/pipeline/189325/trigger-webhook?token=98a7a230afe6827ba8a2cd1e96c626ba6b0d0e289a25ef9094129bc28d02763f703bfea3d8e37fe2dabe61875b242f51
fromScratch=1
&tag=version%201
%env=val

REST API

Another way of triggering the pipelines is using Buddy's external REST API. What you need to do is execute the Resource URL (below) and send to it POST Param to_revision.

POST
/workspaces/:domain/projects/:project_name/pipelines/:pipeline_id/executions

Detailed documentation on running a pipeline with the API is available here.

API requests need to be authorized first. For that, you can either use OAuth or a personal access token.

Commit commands

Pipelines can also be run remotely from the terminal with commands attached to commit messages. For example, $ git commit -am "website hotfix --run production" will trigger a pipeline named 'Production'.

ActionCommand
Run a specific pipeline-- run NAME -- run "NAME WITH SPACES"
Do not run (automatic) pipelines-- skip
Clear cache before running--clear-cache
Upload everything from scratch--from-scratch

Slack

Integrating Buddy with Slack will let you run pipelines with slash commands. To configure the integration, go to the pipeline details and click 'Slack handle' in the right menu. The option will open a box with the pipeline URL required to configure the slash commands: Slack Slash Commands

Slash commands

Once configured, you can run the following commands from your Slack channel:

ActionCommand
Get pipeline status/[name] status
Run execution/[name] run
Run execution + clear cache/[name] clear run
Cancel execution (must be in progress)/[name] cancel
Run execution again (must be terminated or canceled)/[name] retry
Run execution from scratch/[name] refresh
Run execution from scratch + clear cache/[name] clear refresh
Run and refresh can be used with any revision/[name] run/refresh 1c002dd
Clear and revision can be run together/[name] clear run 1c002dd
Approve a waiting pipeline/[name] approve
Pass params to the waiting pipeline:/[name] params a=b c="some text"*

*[name] is the name of the command that you entered in Slack.

For wildcard pipelines you can send the branch, tag or pull request:

/[name] clear run tag=1.1
/[name] clear run branch=dev
/[name] clear run pullRequest=feature-update
/[name] clear run revision=1c002dd