How to pass a custom env variable when triggering a Bitrise workflow?

Hello, and thanks a lot for all the work you’re doing on Bitrise!

My situation is the following:

Workflow1 in App1 triggers a Bitrise Workflow for Worflow2 in App2

I need to pass in some custom parameters from Workflow1 in App1 to Worflow2 in App2 (I guess through environment variables), but I can’t find a way to do this:

Of course when setting an env variable in Workflow1 in App1 like this, it can’t be found in Worflow2 in App2:
envman add --key MY_RELEASE_NOTE --value "This is the release note"

Can you please recommend a solution?

Thanks!

Environment variables can be passed using build trigger API: http://devcenter.bitrise.io/api/build-trigger/#specify-environment-variables

1 Like

Thanks @koral. Can this be done in the workflow editor? I can’t see a way to do it from there with a Trigger Bitrise workflow step. Would be really nice to be able to add env variables there.

Or is this module created by a 3rd party dev, and hence I’ll have to edit the module myself for my needs?

It’s a 3rd party step but I’m the author and I can add such feature.
How would you like to configure variables to be passed?
Do you want to specify only names (so values will be taken from the current environment) or name-value pairs?

1 Like

Oh that’s pretty cool @koral thank you for contributing that step, it’s super useful!

I think both would be useful to me:

  • Forwarding an environment variable that has been set in a previous step.
  • Adding new custom environment variables with custom values (name-value pairs).

Thanks a lot really for offering to add this feature!

Just to add my note @koral, probably better to start with just forwarding envs (only specifying keys) as it’s easier to make it “bullet proof”.

In case of key-value pairs you might either have to prepare for multi line values somehow, or not to handle multi line values, while with forwarding envs multi line values are not an issue at all.

1 Like

Right, it is much easier to implement forwarding based on key list. I’ve just added that.
In the meantime I discovered several issues related to environment variables on Bitrise: Various failures when environment is going to contain “=”

1 Like

That’s awesome @koral thanks a lot for that! Will that be available soon in v 0.0.2?

Yep, in 0.0.2 there is a new input for | separated list of variable names to export. Their values are passed to Build Trigger API with is_expand set to false.

2 Likes

Does it take time for the new version to be uploaded on Bitrise? I still only see v0.0.1.

Yes, it does take some time as every update has to go through a manual approval. I just approved v0.0.2 of the step, so it’s in the StepLib now, but on the web UI it might take some time to appear, until the caches used by the UI are refreshed.

1 Like