You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when using custom templates in the CircleCI Slack Orb, users need to manually handle the export of environment variables to customize the template fields. This process can be cumbersome and error-prone.
Maybe we could introduce an environment key under the slack/notify job where users can define environment variables directly within the CircleCI configuration. These variables would then be automatically available within the custom Slack templates, reducing the need for manual export steps.
Examples:
- slack/notify:
channel: some-channel
branch_pattern: main
template: basic_fail_2
environment:
FAILURE_MESSAGE: "Please take care of this issue ${SELECTED_VOLUNTEER}!"
Thanks!
The text was updated successfully, but these errors were encountered:
Hi @mlachkar-da unfortunately the solution you propose is not possible today on CircleCI as the parameters cannot be a map.
But you have several ways to pass multiple environment variables without manual exports. The first one is to use a context, you can create a context with all the variables you need on the template and pass it to the job call like this:
- your-job:
context: SLACK_TEMPLATE
The second is to use a docker executor and pass the environment to the executor, it would look like this on the job definition:
docker:
- image: ubuntuenvironment:
FAILURE_MESSAGE: "Please take care of this issue ${SELECTED_VOLUNTEER}!"steps:
- slack/notify:
channel: some-channelbranch_pattern: maintemplate: basic_fail_2
And the last one is to pass the environment on the job definition:
environment:
FAILURE_MESSAGE: "Please take care of this issue ${SELECTED_VOLUNTEER}!"steps:
- slack/notify:
channel: some-channelbranch_pattern: maintemplate: basic_fail_2
You can get more information about passing environment variables here
Describe Request:
Currently, when using custom templates in the CircleCI Slack Orb, users need to manually handle the export of environment variables to customize the template fields. This process can be cumbersome and error-prone.
Maybe we could introduce an environment key under the slack/notify job where users can define environment variables directly within the CircleCI configuration. These variables would then be automatically available within the custom Slack templates, reducing the need for manual export steps.
Examples:
Thanks!
The text was updated successfully, but these errors were encountered: