(fix) malformed YAML in SLES 16.1 product files#3378
Conversation
lslezak
left a comment
There was a problem hiding this comment.
Let's use yq for YAML validation.
|
|
||
| container: | ||
| # TODO: is this too much? | ||
| image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby |
There was a problem hiding this comment.
I'd avoid downloading our special Docker image if really not needed. OBS is sometimes slow or download fails. This causes false alarms and you have to restart the CI, sometimes even several restarts are needed.
In this case we could simply use the yq tool (similar to jq but for YAML). It is already preinstalled in the default Ubuntu image in the GitHub actions. This will make the CI run also much faster.
Simply running yq should be enough:
> yq sles_161.yaml
Error: bad file 'sles_161.yaml': yaml: line 349: mapping values are not allowed in this contextIt reports the same failure as Ruby YAML parser:
> ruby -ryaml -e 'Dir.glob("*.{yml,yaml}").sort.each { |fn| puts fn; YAML.safe_load(File.read(fn)) }; puts "OK"'
kalpa.yaml
leap_161.yaml
leap_micro_62.yaml
microos.yaml
sles_161.yaml
Traceback (most recent call last):
6: from -e:1:in `<main>'
5: from -e:1:in `each'
4: from -e:1:in `block in <main>'
3: from /usr/lib64/ruby/2.5.0/psych.rb:314:in `safe_load'
2: from /usr/lib64/ruby/2.5.0/psych.rb:350:in `parse'
1: from /usr/lib64/ruby/2.5.0/psych.rb:402:in `parse_stream'
/usr/lib64/ruby/2.5.0/psych.rb:402:in `parse': (<unknown>): mapping values are not allowed in this context at line 349 column 19 (Psych::SyntaxError)I'd fallback to Ruby only when yq is not installed.
There was a problem hiding this comment.
BTW there is also the yamllint tool pre-installed. But it looks too strict, IMHO yq is enough:
> yamllint sles_161.yaml
sles_161.yaml
1:1 warning missing document start "---" (document-start)
24:81 error line too long (83 > 80 characters) (line-length)
29:81 error line too long (82 > 80 characters) (line-length)
39:81 error line too long (84 > 80 characters) (line-length)
50:81 error line too long (83 > 80 characters) (line-length)
63:81 error line too long (84 > 80 characters) (line-length)
70:81 error line too long (81 > 80 characters) (line-length)
75:81 error line too long (83 > 80 characters) (line-length)
88:81 error line too long (84 > 80 characters) (line-length)
92:81 error line too long (81 > 80 characters) (line-length)
184:25 warning too few spaces before comment (comments)
210:81 error line too long (92 > 80 characters) (line-length)
212:35 warning too few spaces before comment (comments)
212:81 error line too long (89 > 80 characters) (line-length)
228:81 error line too long (81 > 80 characters) (line-length)
261:81 error line too long (107 > 80 characters) (line-length)
335:81 error line too long (81 > 80 characters) (line-length)
349:19 error syntax error: mapping values are not allowed here (syntax)
370:81 error line too long (107 > 80 characters) (line-length)|
@lslezak the Ubuntu runner has Ruby, so I implemented the yq check and then reverted it. It's simpler with Ruby :) |
schema validity is not even a question, it simply does not deserialize Caught by daily ci-integration-tests.yml
yq is present in the ubuntu-latest GH Action runner ruby is on our openSUSE machines
Guess what. The Ubuntu runner has Ruby too. yq is not needed. This reverts commit e8995b5.
918de44 to
8c288c7
Compare
Prepare to release version 20. * #3294 * #3295 * #3296 * #3297 * #3298 * #3299 * #3300 * #3301 * #3302 * #3303 * #3304 * #3305 * #3306 * #3307 * #3308 * #3309 * #3310 * #3311 * #3312 * #3313 * #3315 * #3316 * #3317 * #3318 * #3319 * #3320 * #3322 * #3323 * #3325 * #3326 * #3327 * #3329 * #3330 * #3331 * #3333 * #3334 * #3336 * #3338 * #3339 * #3342 * #3343 * #3349 * #3351 * #3352 * #3353 * #3354 * #3356 * #3357 * #3358 * #3359 * #3360 * #3361 * #3362 * #3363 * #3364 * #3365 * #3366 * #3367 * #3368 * #3371 * #3372 * #3373 * #3375 * #3376 * #3378 * #3379 * #3380 * #3381 * #3382 * #3385 * #3386
Problem
Solution
Testing
Screenshots
No
Documentation
Do we need more docs? No, just more tests to catch it before the PR is merged.