Environment variables' sequence

Environment vairalbes specific precedence order has been described in Circle CI official document:



  1. Environment variables declared inside a shell command in a run step, for example FOO=bar make install.
  2. Environment variables declared with the environment key for a run step.
  3. Environment variables set with the environment key for a job.
  4. Environment variables set with the environment key for a container.
  5. Context environment variables (assuming the user has access to the Context). See the Contexts documentation for instructions.
  6. Project-level environment variables set on the Project Settings page.
  7. Special CircleCI environment variables defined in the CircleCI Built-in Environment Variables section of this document.

I am questioning on sequence of #5 and #6

contexts are used and sharing with all projects in our environment, project-level special environment variables are used only in that project (repo)

When we want to change an environment variable, For example, AWS_ACCESS_KEY_ID, obviously it will be simpler to change or add a new one with same name to that project. Then it will not impact the builds for other projects. Until all projects use this context are using new value, then I can clean the environment variables from each project.

But now, because context is high priority then project-level environment variables, I have to update my pipeline codes to set environment for each build tasks

Anything Circle CI can do to adjust the sequence? Or do you have any better idea to deal with it?

I checked other pipeline tools, such as bamboo, teamcity, jenkins, the global variables are always lower priority than itself variables.

Seems this is a design bug in Circle CI

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.