Environment vairalbes specific precedence order has been described in Circle CI official document:
- Environment variables declared inside a shell command in a run step, for example FOO=bar make install.
- Environment variables declared with the environment key for a run step.
- Environment variables set with the environment key for a job.
- Environment variables set with the environment key for a container.
- Context environment variables (assuming the user has access to the Context). See the Contexts documentation for instructions.
- Project-level environment variables set on the Project Settings page.
- 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?