Passing environment variables into context name in workflows not working

I have different branches on Git, each branch is a different environment. All build steps of all branches are the same. I put all configuration variables into Context.

Here is my config.yml

(...omitted unnecessary parts...)

workflows:
  version: 2
  build_and_deploy:
    jobs:
      - build_step_1:
          context: project-env-${CIRCLE_BRANCH}
      - build_step_2:
          context: project-env-${CIRCLE_BRANCH}
          requires:
            - build_step_1

Now, when I push into branch dev, I expect it should build and load context project-env-dev; but it doesn’t.
It seems to me that CircleCI doesn’t render environment variables in context name.

It seems to me that context is processed before environment variables. So should use parameters instead of env var.

instead of:
project-env-${CIRCLE_BRANCH}

use this:
project-env-<< pipeline.git.branch >>
2 Likes

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