Test-infra: checkconfig returns error for valid config

Created on 17 Nov 2019  路  8Comments  路  Source: kubernetes/test-infra

What happened:
checkconfig returns an error for a valid config. More specifically, checkUnknownFields(..) returns unknown fields that are, in fact, known.

https://github.com/kubernetes/test-infra/blob/c730fab62edb4442547269b17e314b6dd861e925/prow/cmd/checkconfig/main.go#L402-L431

What you expected to happen:
A valid, functional configuration should be considered valid by checkconfig.

How to reproduce it (as minimally and precisely as possible):

  1. Add a legacy slack_reporter field to your Prow configuration.
  2. Run checkconfig with --strict and/or --warnings=unknown-fields warning enabled.

Please provide links to example occurrences, if any:
example

kinbug

All 8 comments

/help

Copying over from that thread ...

That is totally bizarre. I think we should reconsider the bespoke reflection-based code we have in there to check for bad fields. I don't think that it is worth the effort to maintain it over strict YAML loading as allowed by the library. The only reason I remember being given for the code as-is, was that the library only told you about one unknown field at once. At least it is more robust, I would expect. This code keeps biting us and I don't think it's given us much value...

@cjwagner @fejta

warns about org: too (peribolos)

docker run -it -v /home/afirth/git/github-automation:/tmp gcr.io/k8s-prow/checkconfig \
--plugin-config=/tmp/plugins.yaml \
--config-path=/tmp/config.yaml
{"component":"checkconfig","file":"prow/cmd/checkconfig/main.go:76","func":"main.reportWarning","level":"warning","msg":"unknown fields present in /tmp/config.yaml: orgs","time":"2020-01-15T14:20:29Z"}

On Slack consensus was reached to remove the reflection-based validation and just to use the strict YAML loading -- @afirth do you want to take a stab at that?

/cc

On Slack consensus was reached to remove the reflection-based validation and just to use the strict YAML loading -- @afirth do you want to take a stab at that?

Sure. Do we need a flag to leave the old unstrict behaviour? Looks pretty straightforward to rip out all the unknown field stuff, just not sure how others are using this

/assign @afirth

/remove-help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cjwagner picture cjwagner  路  3Comments

chaosaffe picture chaosaffe  路  3Comments

sjenning picture sjenning  路  4Comments

MrHohn picture MrHohn  路  4Comments

xiangpengzhao picture xiangpengzhao  路  3Comments