# Passing environment variables into context name in workflows not working

**URL:** <https://discuss.circleci.com/t/passing-environment-variables-into-context-name-in-workflows-not-working/35197>\
**Category:** Build Environment\
**Tags:** circle-yml\
**Created:** [March 31, 2020, 4:08pm UTC](https://discuss.circleci.com/t/passing-environment-variables-into-context-name-in-workflows-not-working/35197 "2020-03-31T16:08:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![petehouston](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/petehouston/32/24503_2.png) [@petehouston](https://discuss.circleci.com/u/petehouston)\
**Post date:** [March 31, 2020, 4:08pm UTC](https://discuss.circleci.com/t/passing-environment-variables-into-context-name-in-workflows-not-working/35197/1 "2020-03-31T16:08:49Z")

</div>

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`

```auto
(...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.

 ![Screen Shot 2020-03-31 at 11.07.56 AM](https://global.discourse-cdn.com/circleci/original/3X/a/b/ab731f7c737c6bde0e9fe3360aaae21c3915bf44.png)

---

<div class="post-metadata">

**Author:** ![petehouston](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/petehouston/32/24503_2.png) [@petehouston](https://discuss.circleci.com/u/petehouston)\
**Post date:** [March 31, 2020, 6:36pm UTC](https://discuss.circleci.com/t/passing-environment-variables-into-context-name-in-workflows-not-working/35197/2 "2020-03-31T18:36:23Z")

</div>

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

```auto
instead of:
project-env-${CIRCLE_BRANCH}

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

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [April 10, 2020, 6:36pm UTC](https://discuss.circleci.com/t/passing-environment-variables-into-context-name-in-workflows-not-working/35197/3 "2020-04-10T18:36:28Z")

</div>

Closed on April 10, 2020, 6:36pm UTC

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