-
Notifications
You must be signed in to change notification settings - Fork 15
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
Chore: filter out more redundant scopes from ConfigurationVariablesBy… #753
Conversation
client/configuration_variable.go
Outdated
var filteredVariables []ConfigurationVariable | ||
for _, variable := range result { | ||
if scope == variable.Scope { | ||
filteredVariables = append(filteredVariables, variable) | ||
} |
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.
that's not good enough 😅
as per the explanation in the issue #751
There'd be several variables from the same scope "type" from a different specific scope.
you'd get more variables from the API in the PROJECT
scope, but which are NOT defined on the requested projectId
.
Does that make sense?
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.
Each variable has a scope
and a scopeId
.
The scope can be ENVIRONMENT
, PROJECT
, etc.
The scopeIds are uuids fir the specific environment, project, etc. respectfully.
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.
so.. should I filter instead based on scope ID? (instead of scope).
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.
Exactly
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.
updated.
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.
Approved by mistake 🤦
client/configuration_variable.go
Outdated
// The API returns variables of upper scopes. Filter them out. | ||
var filteredVariables []ConfigurationVariable | ||
for _, variable := range result { | ||
if scopeId == variable.ScopeId { |
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 would also add scope == variable.Scope
here for safety
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.
@Wassap124 - do you concur?
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.
it's conceptually redundant but it won't harm + add explicitness to the code, so im not against it.
Also that way it'd be the exact same validation / predicate that's being made on env0 code post change so it'd be aligned with 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.
done!
btw @TomerHeber we hadn't forgotten about this PR, we've started QAing this |
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 QAed it and it looks good 🙃
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.
Great work 🫶🏻
…Scope
Issue & Steps to Reproduce / Feature Request
closes #751
Solution