kubebuilder icon indicating copy to clipboard operation
kubebuilder copied to clipboard

Scaffold a comment in the PROJECT file to let users know that they should not update it

Open camilamacedo86 opened this issue 2 years ago • 2 comments

What do you want to happen?

I'd like to see in the PROJECT file something like:

# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.

So that, we could make clear that users should not change it. Motivation: https://github.com/kubernetes-sigs/kubebuilder/issues/2634

PS.: Note that if we go into the store.go and try to add the comment when the file is created the following error will be faced when we try to parse / unmarshal it:

Error: unable to load the configuration: unable to determine config version: error converting YAML to JSON: yaml: line 18: mapping values are not allowed in this context

In this way, we need to see if new versions of the libs to work with YAML used can deal with comments or check if we can provide an alternative solution.

Extra Labels

No response

camilamacedo86 avatar Jul 01 '22 09:07 camilamacedo86

/assign

laxmikantbpandhare avatar Jul 03 '22 18:07 laxmikantbpandhare

From the KB meeting: Maybe would be better something like "# Code generated by tool. DO NOT EDIT IF YOU DO NOT KNOW WHAT YOU ARE DOING" OR AT YOUR RISK.

camilamacedo86 avatar Aug 25 '22 16:08 camilamacedo86

Hi, @camilamacedo86 and @laxmikantbpandhare. I've tried adding simple prepend on yaml pkg's Save() function for this.

But I can't seem to observe the same unable to load the configuration error(unit tests+manual 'init,' 'create api' calls), so I've made a pr(#3137) for now.

Let me know if you've planned a different approach, or I've missed something.

jason1028kr avatar Dec 26 '22 23:12 jason1028kr

Hi @jason1028kr,

We can close this one as done. Thank you for your contribution !!!

camilamacedo86 avatar Feb 11 '23 15:02 camilamacedo86