Skip to main content
All CollectionsKnowledge BaseGeneral issues
Organization-level Environment Variables
Organization-level Environment Variables
Updated over 4 months ago

Issue:

An Environment Variable (Env Var) is needed to be available for an entire Bitrise Organization but Env Vars are only available at the app level and the Workflow level.

Possible solutions:

  1. Upload a file that contains the Env Var definitions in the following format to the Generic File Storage:

    Note that you need to provide a unique ID for the file when you upload it to the Generic File Storage. You will need this ID later!

    testvar=testvaluetestvar2=testvalue2
  2. Add a Personal Access Token to your account to be able to authenticate with the Bitrise API.

  3. Add a Script Step to the Workflow. We'll use this to download the file from the other app using the Bitrise API.

  4. Add the API command to the Script content input of the Script Step. You will need your API key, the app slug of your app, and the ID of the file you uploaded to Generic File Storage:

    curl -X GET -H "Authorization:<access-token>" "https://api.bitrise.io/v0.1/apps/{app-slug}/generic-project-files/{generic-project-file-ID}" > file
  5. Add another Script Step to your Workflow. We'll use this to get the file contents and add them to the Env Vars:

    #!/usr/bin/env bashfile="$1" while IFS="=" read -r key value; do if [ ! -z "$key" ] ; then  envman add --key "$key" --value "$value"  fi  done < "$file"

Additional information:

Did this answer your question?