ENV vars not showing up in workflow?

#1

Hello!

I’m currently using a curl command to trigger a bitrise build:

curl https://www.bitrise.io/app/XXXXXXX/build/start.json \
--data '{"hook_info":{"type":"bitrise","api_token":"XXXXXXXX"},"build_params": {"tag":"XXXXXXXX"},"environments":[{"mapped_to":"SOME_ENV_VAR","value":"1234","is_expand":true}]}'

In the workflow that gets kicked off for the resulting build, I have a script step that does this:

#!/bin/bash
set -ex

# write your script here
echo "value = $SOME_ENV_VAR"

but all I see in the logs are:

+ echo 'value = '
value =

Why is the SOME_ENV_VAR not showing 1234 in the logs when the script step gets run?

Even when I echo the environment vars list with “printenv”, I don’t see it in the logs, either.

From what I understand, these APP ENV vars should be available in the workflows…What exactly am I missing?

1 Like

#2

I had the wrong nesting for the json data I was posting:

It should look like this:

--data '{"hook_info":{"type":"bitrise","api_token":"XXXXXX"},"build_params":{"tag":"XXXXXXX","environments":[{"mapped_to":"SOME_ENV_VAR","value":"1234","is_expand":true}]}}'

2 Likes

#3

Just for future reference, it’s also worth to mention that you can’t overwrite env vars defined in your config (bitrise.yml) with API defined env vars just by specifying the env var through the API call.

If you want to do that please follow this guide:

1 Like