Search code examples
androidshcirclecicircleci-2.0circleci-workflows

How to access Environment Variables, created in Context, in my config.yml file?


Since I cannot push my jks file and keystore.properties file to my public Github repository, I followed Signing Android APK’s with CircleCI and Continuous Integration and Deployment with Android, the right way posts. But none of them show how to access an environment variable created in Contexts. I need these context environment variables to download jks file and export secret credentials such as key alias to keystore.properties file which is executed in my .circleci/ci-scripts/circleci_env_setup.sh bash script. Even I followed the documentation I get the following error:

Keystore file is missing, performing download for "" at ""
curl: option -o: requires parameter

And this proves that I cannot access STORE_FILE and KEY_STORE_URI environments correctly. You can see my all circle ci work from this repository. Any help would be appreciated. Thanks in advance.


Solution

  • In a workflows key in your CircleCI Config, you need to apply to context the job: https://circleci.com/docs/2.0/contexts/

    If you don't need workflows (you're using a single job), you don't need to use contexts at all. Just use private environment variables from your project's settings page.