I have some files uploaded in the generic file store and in my workflow I have a file download step. Now depending on a variable called “society” I need to replace part of the environment variable name to download. Basically, I need to do something like:
$BITRISEIO_firebase_info_${society}_URL
Which would give me something like
$BITRISEIO_firebase_info_AUS_URL
Which then expands to a URL to download a file.
As far as I can tell, it’s not possible to have a variable expand inside of another variable. I tried a few different ways and my file download step always errored.
If you then want to use the value in another step then you can expose the result to a new env var, e.g. CURRENT_FIREBASE_INFO_URL which then can be used in step inputs directly:
If don’t need actual final variable but only its value you can use more explicit approach like this: printenv BITRISEIO_firebase_info_${society}_URL
Note there is no leading $.
Usage with envman: envman add --key FOO --value $(printenv BITRISEIO_firebase_info_${society}_URL)