-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce project-level environment variables #4456
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Any updates? |
Great to hear. This is currently blocking us from adopting the gitpod way of doing things. Since we cannot use prebuilds (private npm registry), each dev currently creates a single pinned workspace per project and reuses it. This is because creating a new workspace per issue would take too long without prebuilds. |
+1 for this feature. |
I would prefer to keep gitpod teams and github teams separate. We have third party devs that are working on code that doesn't need access to the secrets and we would like them to continue to not have access to them. That said, I could see this being solved by
|
It would already be immensely helpful to be able to define (public) env variables in .gitpod.yml without any UI whatsover. Our repo is using So we're changing the yarn config in the prebuilds to use a local (persisted) cache, but without extra steps does not carry over to workspaces spawned from the prebuilds. To avoid changing the config files, we need to set environment variables for each workspace. This can be done with startup scripts, but is currently very repetitive. With two startup tasks, we need to do this:
|
+1 for this feature 👍 |
+1 |
I can't wait to have this feature 👀 I need to run prebuilds and be able to install private NPM packages |
meanwhile, what will be the recommendation to use a private registry for prebuilds? is env vars injected into custom docker build phase? |
@andreafalzetti @XBeg9 I am using my user environment variables during prebuild here - |
@shaal does it mean that every single user should put this env into config until this feature will be done? Just out of curiosity, when prebuild triggers, specifically for team, which envs will be injected into the build pipeline? |
@ntziolis same here, if envs are injected into prebuild phase even from project / team level, this is gonna be a security issue |
As a workaround try creating the file FROM gitpod/workspace-full:latest
ENV YOURENV=yourvalue Then in your image:
file: .gitpod/Dockerfile This will allow the env vars to be configured per-project and stored in source code for the project. |
this way you are exposing the secret, right? @jgallucci32 |
If you had sensitive data in the env var then yes. But the examples above were using all non-sensitive env vars so this workaround would be OK in those cases. |
Okay, we've decided to move forward with Project-level environment variables, and I'll build a first iteration. We'll likely implement this as a new feature under a Project's settings, and worry about aligning or deprecating the current User-level variables later. (This way, we can make it 100% clear upfront where/when exactly the new Project-level variables are exposed, and there is no overlap with the current User-level variables, thus we avoid unexpected/surprise variable leaks by design.)
Next up, I'll try to clarify the full Project-level env var access matrix, in order to make sure that we cover all desired use cases safely. (Spoilers: Both Gitpod Team membership and GitHub/GitLab/Bitbucket repository access can give you access to Project-level variables. This is likely okay for private repositories, but raises questions for public repositories, for which anyone can consume prebuilds.) |
@jankeromnes Thank you for all the work on this! If I have an open-source project, hosted on Github, that will use Gitpod's future project-level environment variables, anyone that open that project in Gitpod, will have access to the project's environment variables? If that is true, would you consider changing it to give the access to project's environment variables, only to people with "write" access to that repo? |
Thank you for the update. I would suggest to make the following disabled by default.
And i agree with @shaal, that if there is such implicit access to secrets it should generally be limited to folks that have a certain trust level. Write access to the source seems like the right path here. |
Thanks @shaal and @ntziolis for your feedback!
Yes, this is the current idea, but I'm happy to further discuss it so that we can work towards a better solution that addresses all use cases safely. The arguments going for "project variables available in prebuild are also available in (any) workspace" go as follows:
I understand that "provide environment variables to prebuilds of a public repository without sharing them with users of that public repository" is a use case that isn't covered by our current design. (Note: this limitation only applies to public repositories -- for private repositories, you can only use them in Gitpod if you already have access to them, so environment variables are effectively only accessible to project members.) Currently, we're here:
However, thinking again, maybe "In Workspace?" could actually be a configuration option per Project-level environment variable. E.g. a checkbox when you create a new variable:
But for consistency, if we allow hiding some Project variables from Workspaces, we also need to do a good job of protecting the value from "leaking" outside of Prebuilds. This means doing as good a job at it as other CI services, e.g. by doing:
|
Alternatively, a more fine-grained option than a checkbox to control the visibility of Project environment variables could be a
However, for simplicity's sake, let's keep it as a on/off checkbox during initial implementation. This option could be a follow-up enhancement in case of strong interest. |
Update: This feature is now deployed! 🎉 Here is how to use it:
The UI allows to define new environment variables that will be visible during your Project's Prebuilds. 📝 |
Also FYI, I'll give a short demo of this feature in today's open office hours on Discord, in just under 1 hour. 🙂 |
Can this be done via the cli? The UI is too hard to use for 20 env vars |
Hi @devxpy, not yet but could you please react with a " 👍 " on the following issue? If the CLI support was there for projects, you could use such a method to quickly add env vars in bulk.
|
Problem to solve
The product currently supports only user-level environment variables set in user settings, where you use a scope syntax to specify for which projects the variable should be available to use. See
/variables
and relevant docs.With the upcoming Teams & Projects features, it will be able to set up a project and share this project configuration with other team members under a team.
Proposal
Given there's also a plan to add project and team settings, it could make sense to add support for project-level environment variables or even team-level environment variables. This could also protect variables from being accidentally deleted or changed, and more as these could be read-only to non-owner members.
TBD (To be discussed)
The text was updated successfully, but these errors were encountered: