May 8, 2019 | Last updated: September 21, 2020
Feature spotlight: Passing parameters between actions
The 'Pass arguments' action in Buddy lets you ask about parameters during pipeline execution. The parameters are available in consecutive actions as environment variables. This way you can change the behavior of a pipeline while an execution is in progress.
Parameters can be used in many different cases, such as building scripts or trigger conditions. For example, you can ask at the beginning of the execution whether to send a notification about a new version.
Since we released the action last year it grew very popular and many a time we get amazed how people are using it. With today's release we gave it some lifting and added some very interesting options, such as setting the default value.
Configuring 'Pass arguments' action
Let's assume we have a simple pipeline which tests and deploys the application, and notifies our clients via Slack.
Pipeline example
Let's add an action that will ask whether to send the Slack message. To do that, click the + above the testing action and select 'Pass arguments':
Pass arguments action
Configure the following details:
- set the parameter name to
SEND_MESSAGE
- set the input mode to 'options'
- set the value to
YES
andNO
, each in a separate
Action details
Now we can set the trigger condition for the Slack action:
- go to the 'Condition' tab
- select 'Run only if ENV VAR value has specific value'
- set the condition to run only if
SEND_MESSAGE
isYES
Setting up Slack actions
Running the pipeline
Once you trigger the pipeline, Buddy will ask if you want to send the Slack message:
Entering the message
If you select 'NO' as the answer, the Slack action will be skipped from the execution:
Pipeline with skipped Slack action
Input mode
When adding a parameter we select the input mode which defines the way the value will be entered by the user:
- Input – the value is entered manually
- Options – multiple values entered in a separate line each, selected from a dropdown
- Options from file – the user selects a file with the options to choose from, each value in a separate line. This way you can store the options in the repository, or list them in a build action or another pipeline
Pass arguments
Permissions, encryptions and default value
- Enabling value encryption will blur it in the execution logs.
- The default value, on the other hand, will suggest a specific value when prompted, so that you won't have to enter it manually every time.
- Permissions let you specify which users or groups of users are allowed to define the values (e.g. admins only)
Project permissions
Using parameters in build actions
All parameters are available in build actions as environment variables that can be used in Buddy's scripts. For example, to display the value of SEND_MESSAGE
, you just need to refer to this variable in the script:
Run tab
More from Buddy
Make sure to check out our articles on environment variables and trigger conditions to learn how Buddy can help you optimize your delivery workflow – and pull off more amazing stuff that makes us truly proud of what we created.
Cheers!
Share:
Alexander Kus
Customer Success Manager