Ericsson / .allstar

OpenSSF Allstar configuration for Ericsson Github org
0 stars 1 forks source link

Branch protection config error. #3

Open jeffmendoza opened 6 months ago

jeffmendoza commented 6 months ago

@gkunz Allstar is throwing an error on this line here

"json: cannot unmarshal bool into Go struct field OrgConfig.requireStatusChecks of type []branch.StatusCheck" https://github.com/Ericsson/.allstar/blob/78d8f52ac0eaa7adc87189690ca35aa142b5f1d8/branch_protection.yaml#L11

Here is the documentation for that field

// RequireStatusChecks is a list of status checks that are required in
    // order to merge into the protected branch. Each entry must specify
    // the context, and optionally an appID.
    Require[StatusCheck](https://pkg.go.dev/github.com/ossf/allstar@v0.0.0-20240308161059-964a34c8c454/pkg/policies/branch#StatusCheck)s []StatusCheck `json:"requireStatusChecks"`

https://pkg.go.dev/github.com/ossf/allstar@v0.0.0-20240308161059-964a34c8c454/pkg/policies/branch#OrgConfig https://pkg.go.dev/github.com/ossf/allstar@v0.0.0-20240308161059-964a34c8c454/pkg/policies/branch#StatusCheck

Some docs https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches#require-status-checks-before-merging https://docs.github.com/en/rest/branches/branch-protection?apiVersion=2022-11-28#get-status-checks-protection

So it should be something like this:

requireStatusChecks:
- context: DCO
  appID: 123
- context: continuous-integration/travis-ci
gkunz commented 6 months ago

Hi @jeffmendoza, thanks a lot! I noticed my mistake that this option is a list rather than a bool and removed it from the configuration for now. I am currently still working on a sample config that I understand and could role out across the org. I am currently a bit puzzled by the fact that Allstar still complains about the branch protection policy, but I keep debugging my config.