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

step
contrib-this-feature
#1

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: https://github.com/bitrise-io/bitrise-contrib/issues/2

0 Likes

Output from multiple instances of the same step
#2

@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

#3

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:

0 Likes

#4

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

0 Likes

#5

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

This should now cover all remaining use case for this #feature-request so closing it :slight_smile:

0 Likes

closed #6
0 Likes