Add workflow to run conda-store user journey tests#2895
Add workflow to run conda-store user journey tests#2895marcelovilla merged 14 commits intonebari-dev:mainfrom
Conversation
8bb4c2a to
814d7e8
Compare
|
depends on conda-incubator/conda-store#1040 |
814d7e8 to
b58c5c7
Compare
|
Since these tests depend on a live cluster, I suggest extending the already existing local integration tests with this extra check https://github.com/nebari-dev/nebari/blob/main/.github/workflows/test_local_integration.yaml -- since it uses CiRun under the hood you should not be affected by any flakiness of the GH runner in case of constrained resources. |
8d941b5 to
c108c2f
Compare
647dee8 to
3a6689a
Compare
|
Hey @soapy1 no rush on this, but could you update us on this? Just considering adding to our next |
|
Heya @viniciusdc I've gotten a bit stuck on this one. I'm not able to find a way to pull an admin token for conda-store from nebari in order to run the tests (full notes in this comment - #2895 (comment)). Things that I've tried:
Other options I've considered (but haven't tried yet):
Definitely open to other ideas if you have a suggestion! |
|
I left a comment to your thread there, but basically I think your best options are those two:
nebari/src/_nebari/stages/kubernetes_services/__init__.py Lines 446 to 448 in ecaa94b nebari/qhub/stages/input_vars.py Lines 271 to 278 in 81ff2fb Used for example here:
try:
# Get user ID
users = keycloak_admin.get_users({"username": USER_TO_ADD})
if not users:
print(f"User '{USER_TO_ADD}' not found.")
exit(1)
user_id = users[0]["id"]
# Get group ID
groups = keycloak_admin.get_groups()
group_id = next((g["id"] for g in groups if g["name"] == "superadmin"), None)
if not group_id:
print(f"Group 'superadmin' not found.")
exit(1)
# Add user to group
keycloak_admin.group_user_add(user_id, group_id)
print(f"User '{USER_TO_ADD}' successfully added to 'superadmin' group.")
except KeycloakError as e:
print(f"Error: {e}")for the main API nebari/src/_nebari/keycloak.py Line 104 in ecaa94b I wonder if this should be configured directly trough nebari's CLI anyway, we already have root access level credentials in the yaml, so it would not be a security overlook to allow the group in which the user will be created to appear as a custom flag as well.... |
ya, I was thinking about adding this. Something like
could make a v1 of this be something like only root users are allowed to set a role? |
| username = args[1] | ||
| password = args[2] if len(args) >= 3 else None | ||
| create_user(keycloak_admin, username, password, domain=config.domain) | ||
| groups = args[3] if len(args) >= 4 else None |
There was a problem hiding this comment.
I'm not a fan of this approach to passing arguments around but did this to follow the pattern already defined in this part of the code.
I would be happy to refactor this module to make it a more developer friendly if that's something the nebari team is into.
Could also split that into a separate PR.
There was a problem hiding this comment.
why don't you split that into a different pr. Thanks!
There was a problem hiding this comment.
Looks like this functionality is also implemented in #2917. Will rebase my changes when it get's merged.
|
@soapy1 this requires the nebari keycloak command update to work, right? If that's the case, @Adam-D-Lewis do you mind splitting that ENH into another PR to decouple from the service-account one? We can also keep it in here as well |
Yeah, I can split that out into a separate PR today. |
|
Here's the keycloak cli refactor PR - #2968 |
|
@soapy1 please let me know when this is ready to go so we can get it merged |
|
This looks great @soapy1 ! In the spirit of achieving testing parity, I think it would be worthwhile to also run these tests on cloud deployments. That's beyond the scope of this PR but something to keep in mind when we start running other test suites in cloud deployments too. |
Reference Issues or PRs
fixes #2760
test_local_integration--groupflag when adding a keycloak userTo create a keycloak user with access to a particular group, run the command
What does this implement/fix?
Put a
xin the boxes that apply