Skip to content

Environment scope doesn't apply consistently for GitLab subgroups #8618

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

Closed
peat-psuwit opened this issue Mar 5, 2022 · 15 comments
Closed

Environment scope doesn't apply consistently for GitLab subgroups #8618

peat-psuwit opened this issue Mar 5, 2022 · 15 comments
Labels
feature: environment variables meta: never-stale This issue can never become stale type: bug Something isn't working

Comments

@peat-psuwit
Copy link

peat-psuwit commented Mar 5, 2022

Bug description

When open a GitLab repository which resides in a subgroup, the environment variable scope which specify the top level group only doesn't apply consistently between the resulting env applied and the result of gp env.

Steps to reproduce

  1. Go to https://gitpod.io/variables, set a variable e.g. VISUAL=gitpod-code --wait, and set the scope to ubports/*.
  2. Open a workspace for https://gitlab.com/ubports/core/packaging/libayatana-common (Shortcut: https://gitpod.io/#https://gitlab.com/ubports/core/packaging/libayatana-common)
  3. Using terminal, compare echo $VISUAL with gp env. echo $VISUAL would show the GitPod's default (/ide/bin/remote-cli/gitpod-code), while gp env would show the set value (gitpod-code --wait).

Workspace affected

No response

Expected behavior

echo $VISUAL should produces the same value as gp env would display. Preferably for my usecase, my variable set should apply to actual environment variables.

Example repository

https://gitlab.com/ubports/core/packaging/libayatana-common, or any repositories under https://gitlab.com/ubports/core/packaging really.

Anything else?

No response

Front logo Front conversations

@pawlean pawlean added the type: bug Something isn't working label Mar 7, 2022
@axonasif
Copy link
Member

axonasif commented Mar 7, 2022

#2702 seems related.
cc @JanKoehnlein

As an temporary workaround, you could do put eval $(gp env -e) on your ~/.bashrc from a custom dockerfile.

@geropl
Copy link
Member

geropl commented Apr 5, 2022

@jldec I created a group "Environment Variables" for this. I'm not sure how our plans for deprecation of "user scope env vars" looks like.

But I guess:

  • it's blocked until we have secrets
  • then we need a smart integration of gp env with project-level env vars...?

OR: are user level env vars meant to stay? 🤔

@J0F3
Copy link

J0F3 commented Jun 13, 2022

I have exactly the same problem. Variables are visible through gp env but not set as an environment variable. Only when I set the scope to */* the variables get set automatically. But that is definitely not what I want to do.

@geropl What do you mean by group? A team or a GitLab Group?

@raphaeltm
Copy link

Just want to add that I've been running into this issue as well.

@stale
Copy link

stale bot commented Dec 16, 2022

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.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Dec 16, 2022
@peat-psuwit
Copy link
Author

Ping. Are you still taking a look into this?

@stale stale bot removed the meta: stale This issue/PR is stale and will be closed soon label Dec 16, 2022
@ceefour
Copy link

ceefour commented Dec 26, 2022

I want to echo @J0F3 's issue that is happening to me too:

I have exactly the same problem. Variables are visible through gp env but not set as an environment variable. Only when I set the scope to */* the variables get set automatically. But that is definitely not what I want to do.

@ceefour
Copy link

ceefour commented Dec 26, 2022

@J0F3 @axonasif I have updated info on Gitpod's behavior as of 26 Dec 2022:

Project path (GitLab repository): soluvas/appstudio/appstudio-auditor

Test results:

Pattern gp env Shell env
soluvas/appstudio/appstudio-auditor Set BUGGY! Not set
soluvas/* Set BUGGY! Not set
*/appstudio-auditor Set Set
*/* Set Set

@J0F3 so a "less worse than */*" workaround is using fixed project's name in the pattern, while the group becomes the wildcard ;-)

@axonasif
Copy link
Member

Thanks for sharing your findings.

@kenibrewer
Copy link

I have also encountered this bug, it definitely was a a big headache to figure out the problem when I was working to onboard my colleagues onto GitPod.

This is particularly important Re: secrets that I want to be especially protective of. I'd really like to limit secrets to as narrow-of-a-scope as possible and needing to set them to / feels very insecure.

@axonasif
Copy link
Member

👋 @kenibrewer could you please react with a " 👍 " on the top (message) of this issue?

@J0F3
Copy link

J0F3 commented Jan 17, 2023

@ceefour Thanks for the Info. Looks a little bit better.

What I have done finally as a workaround was to add the following line to .gitpod.Dockerfile:
RUN echo "eval \$(gp env -e)" >> ~/.bashrc.d/400-gp-env

As I am using a custom image anyway this works for me...

@axonasif
Copy link
Member

axonasif commented Jan 17, 2023

Nice workaround @J0F3! You could also utilize the dotfiles feature with a install.sh that would execute the commands each time you open any workspace. Your install.sh could contain:

#!/usr/bin/env bash

printf 'eval "$(%s)"\n' "gp env -e" > ~/.bashrc.d/400-gp-env

@stale
Copy link

stale bot commented Jun 18, 2023

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.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Jun 18, 2023
@akosyakov akosyakov added the meta: never-stale This issue can never become stale label Jun 21, 2023
@kenibrewer
Copy link

This issue was resolved in #17831 and can be closed.

In case anyone is having issues with gitlab subgroup scoping, be sure to use the pattern org/** instead of org/* to match org/subgroup/repo.

@stale stale bot removed the meta: stale This issue/PR is stale and will be closed soon label Jun 27, 2023
@github-project-automation github-project-automation bot moved this to In Validation in 🍎 WebApp Team Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: environment variables meta: never-stale This issue can never become stale type: bug Something isn't working
Projects
Status: In Validation
Development

No branches or pull requests

10 participants