90% of features and integrations in Buddy are developed in response to popular demand. The most recent includes support for multiple-trigger conditions, a feature that required us to change the pipeline model in the REST API and YAML to have it shipped. The changes also enable triggering pipelines on new events, like creating and removing branches or issuing pull requests.

The update only affects on-premises installations in version 2.3.107 and above.

With the release of v2.3.107, we are starting a grace period during which the data will still be fetched in the old model by default. The period will end with the release of version 2.4.1, scheduled for May 19, 2021.

What you need to know

Currently all responses return the following header:

X-Buddy-Media-Type: buddy.v1.0.0

To adjust your apps that use REST API with the new model, you will have to update it to version 1.1.0 (it will also be visible in responses):

X-Buddy-Media-Type: buddy.v1.1.0

Once the grace period is over, the old default header no longer be supported.

Trigger conditions

At the moment, the changes in the REST API and YAML involve the fields that are responsibe for setting up the trigger condition in the pipeline and/or action:

trigger_condition
trigger_condition_paths
trigger_variable_key
trigger_variable_value
trigger_hours
trigger_days
zone_id
trigger_project_name
trigger_pipeline_name

Those fields can now be replaced by the trigger conditions array:

trigger_condtion[] trigger_condtions

YAML example

Each array object has to be provided with the exact same fields:

 trigger_conditions:
  - trigger_condition: "VAR_IS"
    trigger_variable_value: "expectedValue"
    trigger_variable_key: "myVar"

REST API example

Each array object has to be provided with the exact same fields:

"trigger_conditions": [
    {
      "trigger_condition": "VAR_IS",
      "trigger_variable_value": "expectedValue",
      "trigger_variable_key": "myVar"
    }
  ]

Not sending trigger_conditions array, or sending an empty trigger_conditions: [] will be equivalent of the deprecated trigger_condition: ALWAYS

Trigger modes

  1. ref_type is no longer available
  2. trigger_mode has been replaced with on:
  3. Trigger mode values are replaced with new ones:

    • MANUAL β†’ CLICK
    • ON_EVERY_PUSH β†’ EVENT
    • SCHEDULED β†’ SCHEDULE

For on: "CLICK" and on: "SCHEDULE", you can send a collection of refs for which the pipelines is to be executed. For example:

on: "CLICK"
refs:
- "refs/heads/dev"

For on: EVENT you need to send array of events:

on: "EVENT"
events:
- type: "PUSH"
  refs:
  - "refs/heads/dev"

Refs provided as a name of a brach or tag (e.g. master, tag1) are no longer supported.

Instead, you need to provide a full ref path. For example:

  • Master branch: refs/heads/master
  • Tag t1: refs/tags/t1
  • All branches: refs/heads/*
  • All pull requests: refs/pull/*
  • All refs *

YAML examples

Old:

- pipeline: "buddy"
  trigger_mode: "MANUAL"
  ref_type: "NONE"

New:

- pipeline: "buddy"
  on: "CLICK"

Old:

- pipeline: "buddy"
  trigger_mode: "MANUAL"
  ref_name: "master"
  ref_type: "BRANCH"

New:

- pipeline: "buddy"
  on: "CLICK"
  refs:
  - "refs/heads/master"

Old:

- pipeline: "buddy"
  trigger_mode: "ON_EVERY_PUSH"
  ref_name: "master"
  ref_type: "BRANCH"

New:

- pipeline: "buddy"
  on: "EVENT"
  events:
  - type: "PUSH"
    refs:
    - "refs/heads/master"

REST API examples

Old:

{
  "name": "buddy",
  "trigger_mode": "MANUAL",
  "ref_type": "NONE"
}

New:

{
  "name": "buddy",
  "trigger_mode": "MANUAL",
  "on": "CLICK"
}

Old:

{
  "name": "buddy",
  "trigger_mode": "MANUAL",
  "ref_name": "master",
  "ref_type": "BRANCH"
}

New:

{
  "name": "buddy",
  "on": "CLICK",
  "refs": [
    "refs/heads/master"
  ]
}

Old:

{
  "nam": "buddy",
  "trigger_mode": "ON_EVERY_PUSH",
  "ref_name": "master",
  "ref_type": "BRANCH"
}

New:

{
  "pipeline": "buddy",
  "on": "EVENT",
  "events": [
    {
      "type": "PUSH",
      "refs": [
        "refs/heads/master"
      ]
    }
  ]
}

Changes to execution mode (API only)

  1. mode has been replaced with triggeredOn
  2. triggeredOn uses the same values as pipelines: CLICK, SCHEDULE, and EVENT
  3. During the grace period, data will be fetched in the old way by default
  4. If you want to use the new mode, please use the X-Buddy-Media-Type: buddy.v1.1.0 header
  5. Once the transition period ends, mode will no longer be supported and triggeredOn will become the default.

Once the grace period has finished, the REST API will only support the new model. YAML will continue to support both old and new.