-
Notifications
You must be signed in to change notification settings - Fork 70
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
User and team deployment role management #1553
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1553 +/- ##
==========================================
+ Coverage 86.28% 86.41% +0.13%
==========================================
Files 113 113
Lines 15221 15668 +447
==========================================
+ Hits 13133 13540 +407
- Misses 1260 1280 +20
- Partials 828 848 +20 ☔ View full report in Codecov by Sentry. |
cmd/cloud/deployment.go
Outdated
} | ||
var id string | ||
|
||
// if an email was provided in the args we use it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment seems incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
cloud/team/team.go
Outdated
if teams[i].Description != nil { | ||
teamDescription = *teams[i].Description | ||
} | ||
for _, role := range *teams[i].Roles { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this scares me a lil if theres a bug on core side, then we might end up with nil
pointer exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 protection added
users[i].FullName, | ||
users[i].Username, | ||
users[i].Id, | ||
*users[i].DeploymentRole, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we nil check here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 protection added
} | ||
resp, err := client.MutateDeploymentUserRoleWithResponse(httpContext.Background(), ctx.Organization, deployment, userID, mutateUserInput) | ||
if err != nil { | ||
fmt.Println("error in MutateDeploymentUserRoleWithResponse") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be printing these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are fine as is as we deff want to tell the user an error occurred.
} | ||
err = astrocore.NormalizeAPIError(resp.HTTPResponse, resp.Body) | ||
if err != nil { | ||
fmt.Println("error in NormalizeAPIError") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be printing these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are fine as is as we deff want to tell the user an error occurred.
cmd/cloud/deployment.go
Outdated
} | ||
if updateDeploymentRole == "" { | ||
// no role was provided so ask the user for it | ||
updateDeploymentRole = input.Text("Enter a user Deployment role or custom role name to update team: ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updateDeploymentRole = input.Text("Enter a user Deployment role or custom role name to update team: ") | |
updateDeploymentRole = input.Text("Enter a Deployment role or custom role name to update team: ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the changes
* add cmds for managing deployment user/teams * add unit testing and fix user select bug * add unit test to cmd files * lint * fix default deployment role in add command * fix test name * pr review comments addressed * revert change to flag description for list deployments accross all worksapces * add protections around nil pointers and fix some copy
Description
Adds the ability to CRUD deployment users and deployment teams
🎟 Issue(s)
Related #18925 #18926
🧪 Functional Testing
Ran each method locally to verify it was working as expected
📸 Screenshots
📋 Checklist
make test
before taking out of draftmake lint
before taking out of draft