-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Bug / Feature Request: Add brace expansion, extended glob matching, and 'globstar' matching to user/project environment variable repo patterns #15744
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
Comments
Hi @kenibrewer, first thank you for the thorough and thoughtful issue. We really appreciate it. The challenges you describe and reference and the inconsistencies of environment variables are loaded is definitely something we plan to improve. I do have a few follow-up questions
|
Hi @mbrevoort , Thanks for the response. Short answer to your questions:
Context: |
The context is interesting, thanks! How much does the naming convention of repositories matter to you? Or is it that is just how we have implemented the ability to share environment variables across multiple projects? What if there was a more explicit way to share variables between projects (e.g. pick which projects to share to). How important is the wildcard support? |
Wildcard support would certainly make our lives much easier than than simply having a way to pick which projects to share environment variables to. We've organized our code repositories in Gitlab very hierarchically. For example, any of our bioinformatic pipelines built using Nextflow are sorted into |
The workaround that we figured out whereby users could store credentials scoped to I think this was likely caused by the removal of the support for user environment variables in workspaces launched via the project interface in this pull request. Is the intent to no longer support access to individual environment variables in projects? If so, is there an alternative you could recommend whereby individualized credentials could be accessed? Later this year we plan to move to the AWS SSO pattern you have in this template but it will require some substantial re-configuring of our AWS environment and so we're looking for a secure solution for storing credentials we can use in the meantime. |
hi @kenibrewer
Do you mean it no longer works for |
No. The new problem is that This doesn't make any sense to me. Even in an organization, individual developers may need access to personally defined environment variables. |
This is a known issue, see this comment for a workaround:
It's not an issue with
I think there's a slight misunderstanding there 😇 It rather fixes an issue that |
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. |
This bug is resolved in #17831 |
There are other feature request and bugs that have been submitted related to this problem, but none of them encompass the full set of issues that could be solved by implementing a proper solution. I'm going to attempt to consolidate all those into one issue.
Is your feature request related to a problem? Please describe
Currently the environment variable RepoPattern only supports simple repo structures of the type "/" and simple glob matching where a glob takes the place of one of those two variables. The lack of support for more complex repo structures and advanced matching introduces the following problems.
Setting
SECRET_KEY = XYZ
with the scopecompany/*
will not be loaded in a Gitlab repo of the structurecompany/subgroup/testrepo
.If I would like
SECRET_KEY = XYZ
available in the reposcompany/db
andcompany/frontend
but notcompany/public
I would need to create two different environment variables and remember to change both of them instead of setting an environment variable with the patterncompany/{db,frontend}
.I would like
SECRET_KEY = XYZ
credentials to be available in any dev environment matches the patterncompany/!(internship*)
Describe the behaviour you'd like
Environment variable matching patterns should support the full set of glob-style matching features that developers expect including:
**
matching{a,b}
!
Describe alternatives you've considered
eval $(gp env -e)
after workspace creation can load variables with the basic patterncompany/*
in nested Gitlab reposRelated Issues
The following pre-existing issues would be solved by this feature/request:
Two attempted fixes that were merged but did not actually solve the issue:
gp
CLI, but does solve the full scope of the problems. )Additional context
There is an inconsistency between what environment variables that get loaded during workspace creation/launch and which environment variables get loaded by
eval $(gp env -e)
I have not tested whether project environment variables are subject to the same problems and limitations.
Possible Implementation Notes:
The easiest way to enable full advanced glob pattern matching is probably by using switching the WorkspaceEnvVarAccessGuard to use minimatch.
The score function would need to be changed to resolved environment variable conflicts at any layer of depth. Perhaps a function where the score added for an exact match at a given level of depth is
2^(22-depth)
. (Gitlab supports up to 20 layers of nested subgroups). With this score function higher score would have priority.The various places that use
splitRepositoryPattern
like this one would need to be modified.Additional tests like these ones should be added to test for proper multi-level repo pattern scoping.
The text was updated successfully, but these errors were encountered: