CircleCI Ideas

Multiple Contexts in a Workflow

It would be useful to be able to specify multiple Context's in a workflow. As a general best security practice, any given workflow should only have access to the secrets that it absolutely needs. In order to accomplish this with Context's currently however, many projects would need their own Context, containing only the secrets relevant to that project. This defeats the point of Contexts, making them less reusable. Allowing a workflow to specify multiple Contexts maintains this principle of least privilege, without sacrificing the usability of Contexts. Exampe:

 

workflows:
main:
jobs:
- example-job:
context:
- AWS
- Heroku
- Cloudflare

 

There's more discussion in this forum thread.

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Dec 12 2018
  • Taking votes
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    December 18, 2018 10:47

    Agreed, this is combination with some kind of access control on contexts (on a project/repo level) would make CircleCI feasible for us to use in our larger organization.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    16 Jan 16:21

    Multiple contexts would allow our CircleCI workflow/job setups to be much DRYer.   Many many upvotes for this.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    22 Jan 17:01

    This would definitely reduce the need for contexts containing boilerplate variables. If you consider a CircleCI Context as a set in a Venn diagram, the need for referencing multiple contexts in a CircleCI workflow becomes immediately clear.  There are instances where different contexts should overlap, rather than having slightly altered copies of contexts to suit slightly different scenarios.

    In instances where the same variable exists with the same value, it should simply discard the duplicates. In instances where the same variable exists with different values, an error can be thrown on build. 

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    09 Mar 14:41
    1. workflows:
      main:
      jobs:
      - example-job:
      context:
      - AWS
      - Heroku
      - Cloudflare
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    23 Apr 12:01

    Definitely a big missing feature

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    30 Apr 19:08

    context seems to be an invalid property to config version 2.1, it is going to be deprecated?

  • Admin
    Nathan Dintenfass commented
    30 Apr 21:52

    @Vinicius contexts are fully supported in 2.1 -- possible you have a syntax error, perhaps? If you think you've found a bug, please post it here: https://discuss.circleci.com/c/bug-reports

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    15 May 20:40

    I don't understand if 2.1 fully supports using ONE SINGLE CONTEXT, or MULTIPLE CONTEXTS. Because in my case, using 2.1, I'm not able to use two contexts.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    15 May 20:41

    And docs are not that complete as I would like

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    17 May 15:02

    This is a huge need with monorepo microservices. Right now it leads to huge amounts of configuration, which is error prone and tedious

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    14 Jul 04:53

    This would be great!!

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    23 Jul 14:46

    +1

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    31 Jul 18:07

    +1

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    07 Aug 01:10

    yo, why the f*** are the circle peeps so quiet on this? can we get this supported or not?? 

  • Admin
    Nathan Dintenfass commented
    07 Aug 17:54

    We have been quiet because this hasn't yet been scheduled. We definitely have it on the list of desired context enhancements, but until we are actively designing it or have a release date there's not much more to say. That said, it's currently being looked at as part of our next set of config improvements. We will update here if and when we have news.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    12 Aug 10:17

    For backward compatibility.

    Please, add `contexts` instead of `context`?

     

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    16 Aug 18:26

    I also would support this. It could also serve as a way to differentiate job config between different workflows. In my case, I'd like to have a `nightly-build` context, which allows some long-running jobs to proceed, which are otherwise conditional. But as-is, this only works if it's the _only_ use of context.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    10 Sep 18:24

    any update on this?

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    16 Sep 22:55

    This would make contexts much more usable.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    01 Oct 10:40

    This is a major miss in contexts. Having to replicate a lot of environment variables across multiple contexts now. 

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    15 Oct 07:04

    This is a massive oversight. I'm starting to consider if I made the right choice to go with CircleCI after having to slowly replicate 50 environment variables three times. It took me 5 hours of copy and pasting. Now my hands hurt. On gitlab CI this was a non-issue.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    30 Oct 11:19

     +1

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    06 Nov 02:31

    Agree this is a massive oversight. Either allow defining contexts that include other contexts (server-side), or add a `contexts:` key to the spec. Can't really be that hard.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    29 Nov 14:27

    There have been forum questions regarding setting environmental variables on workflows which obviously overlaps with this.

    Not trying to add anything into the work being proposed, but being able to flag a context as not containing sensitive information REALLY useful as this would then address these issues.

     

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    09 Dec 21:09

    Visa Divorce Vietcombank.khuu ai kia.

    4283103360606091

    NH 09/24. BM....