[Step] "bridge" an environment variable - assign the value of one Step's output to another Environment Variable

From @viktorbenei on Tue Nov 10 2015 09:51:32 GMT-0500 (EST)

Assign the value of one env to another one (Step outputs are just regular Environment Variables)

Ex: if different tools use different envs for the same thing, like ipa path

Something simple like:

#!/bin/bash

set -e

source_env_value="${!source_env_key}"
echo "source_env_key: $source_env_key"
echo "source_env_value: $source_env_value"

echo "=> Mapping $source_env_key to $target_env_key"

set -x

echo -n "$source_env_value" | envman add --key "$target_env_key"



Copied from original issue: [Step] "bridge" an environment variable - assign the value of one Step's output to another Environment Variable · Issue #2 · bitrise-io/bitrise-contrib · GitHub

@viktorbenei Do you think this feature request was covered by the addition of “step output aliases” in Monthly release of Bitrise CLI tools and summary of updates (May, 2017) - CLI v1.6.1 ?

1 Like

It’s mostly covered with that feature indeed, but there might still be a use case for this step, e.g. to “broadcast” env vars. With the output alias you can only specify one alias for that env var, with this step you could copy the value into as many env vars as you like.

Whether that’s useful at all is a different question, but I guess this step can be a good/simple way for someone new to Bitrise CLI/Step dev to get started :wink:

Update: output aliases are now available in the Bitrise CLI (for a while):

Set environment variable step is now available, thanks to @kdobmayer :tada:

This should now cover all remaining use case for this Feature Requests so closing it :slight_smile: