Introducing: API-parameterized executions

Introducing: API-parameterized executions

When we develop new features, we try to keep things simple, yet with no compromise to flexibility. A couple weeks ago we delivered parameterized builds. Although it was met with very positive feedback from the community, some users missed the option to parameterize executions via the API as well.

This option has just been delivered: from now on, you can run a pipeline via the API and pass the parameters that will be available in all actions.

Executions can be parameterized in 2 ways:

API Parameterization: Method #1

This way involves the run execution method. In the execution object you need to pass a list of variables in the following way:

json
"variables": [ { "key": "version", "value": "1.0" }, { "key": "pass", "value": "qwerty", "encrypted": true } ]
Tip
If you want to hide a value in the logs, add the field "encrypted": true to the variable object.

Running the execution via curl looks like this:

bash
curl --header "Content-Type: application/json" \ --header "Authorization: Bearer $token" \ -X POST \ --data '{ "to_revision": { "revision": "HEAD" }, "comment": "hotfix", "variables": [{ "key": "notify_team", "value": "false" }]}' \ https://api.buddy.works/workspaces/buddy/projects/buddy-works/pipelines/1/executions$$$$$
Hint
To the $token variable you need to assign your Personal account token which you can get here

API Parameterization: Method #2

This way involves the Pass parameters action. First, add this action as described here. Once the execution is waiting for arguments, you can resume it using the apply method:

bash
curl --header "Content-Type: application/json" \ --header "Authorization: Bearer $token" \ -X PATCH \ --data '{ "operation": "APPLY_VARIABLES", "variables": [{ "key": "notify_team", "value": "false" }]}' \ https://api.buddy.works/workspaces/buddy/projects/buddy-works/pipelines/1/executions/4$$$$$

Using parameters

All parameters sent to the execution are available as environment variables in our actions and can be used for various tasks. For example, to determine whether an action should be run or not. In such case, you can use a trigger condition that depends on variable value.

Image loading...Trigger condition

Jarek Dylewski

Jarek Dylewski

Customer Support

A journalist and an SEO specialist trying to find himself in the unforgiving world of coders. Gamer, a non-fiction literature fan and obsessive carnivore. Jarek uses his talents to convert the programming lingo into a cohesive and approachable narration.

Aug 8th 2018
Last update: Sep 21st 2020
Share