-
Notifications
You must be signed in to change notification settings - Fork 6
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
Make policy checks its own apply requirement. #61
Make policy checks its own apply requirement. #61
Conversation
for _, globalReq := range globalApplyReqs { | ||
for _, currReq := range r.ApplyRequirements { | ||
if globalReq == currReq { | ||
continue OUTER |
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'm trying to understand this part, doesn't this create infinite loop? This is basically a GOTO statement right?
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.
hmm, no this just allows us to continue from the next iteration of the outer loop without all the ugly syntax of having a boolean to flag this and then checking that in the outer loop before appending the requirement to the result list.
@@ -85,6 +85,19 @@ func (g GlobalCfg) Validate() error { | |||
|
|||
func (g GlobalCfg) ToValid(defaultCfg valid.GlobalCfg) valid.GlobalCfg { | |||
workflows := make(map[string]valid.Workflow) | |||
|
|||
applyReqs := defaultCfg.Repos[0].ApplyRequirements |
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.
Let's maybe put a comment here noting that we always initialize global config with at least 1 repo.
* Make policy checks its own apply requirement. (#61) * Remove warning from docs.
Having this as it's own apply requirement ensures that a project can be applied if it has it's policies passing, independent of whether other projects fail the policy check or not.
Additionally, the error messaging is clearer here.