Stop supporting optional `tag:yaml.org,2002:bool` to ease adoption for GitHub Actions Workflow templating
What steps did you take:
Using on: in a yaml file
What happened:
The on: was replaced with true:
What did you expect:
As on: is a valid field it should not have been converted to true
Anything else you would like to add: This is very strange and impacts the ability to create templates for github actions.
Environment:
-
0.33.0
Hey Craig.
Yes, this is an irritating behavior from what was intended to be an optional part of the YAML 1.1 spec.
👉🏻 An immediate workaround is to make such values explicitly strings by surrounding them in quotes:
name: CI
"on":
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
build:
runs-on: ubuntu-latest
...
...
Now, this was corrected in the YAML 1.2 spec.
However, the current version of the Go YAML package (v2.x of that library) attempted to be compatible with both the YAML 1.1 and YAML 1.2 specs and so continues to accept these synonyms for boolean.
It's been a long-standing issue that this behavior is an annoyance (see go-yaml/yaml#214 for details).
It has been addressed in the not-yet-released version (v3.x) of the the Go YAML package. Even when this version of the package is released, it will be a breaking change for ytt and would need to be scheduled as such.
Floating this:
- https://yaml.org/type/bool.html — is an optional portion of the YAML 1.1 spec (and removed in the YAML 1.2 spec)
- the implementation of which in the current version of the Go YAML Package used in
yttis isolated to an initializer.[1] - as noted above, there are legit use cases for same strings (e.g.
on) as strings. - I have yet to see someone seriously use these aliases.
Which gets my mind to what @m0un10 is pointing out, here: that this optional implementation portion of the YAML spec is actively aggressive for a whole class of potential users.
What's the downside of introducing a breaking change where we simply no longer support these optional boolean aliases?
[1] https://github.com/vmware-tanzu/carvel-ytt/blob/faafacea467ccd661809f763d77bfb254574f86c/pkg/yamlmeta/internal/yaml.v2/resolve.go#L40-L45
sorry, I accidentally closed it (so re-opened it). I was just going to leave a comment to say that commenting out line 42 and rebuilding gives me a way forward for templating github actions workflows. It would be great if the aggressive bool tag renaming got removed in a future release though!
Okay... I suspect no one is using any of the synonyms.
To avoid confusion, I'm suggesting that we support none of the synonyms.
Not:
-
on/On/ON -
off/Off/OFF -
y/Y/yes/Yes/YES -
n/N/no/No/NO
and only support the true/false variants:
-
true/True/TRUE -
false/False/FALSE
Querying the community: https://kubernetes.slack.com/archives/CH8KCCKA5/p1623796540037600
This would addresses #146 (and the many (#189) many (#219) many (#275) subsequent reports of running into this issue).
Getting absolutely no pushback on this issue. And we're getting a regular report of this being an irritant.
Let's do it.
This one has yet to be prioritized and it caught another: #764 . sigh