Skip to content

(fix) malformed YAML in SLES 16.1 product files#3378

Merged
mvidner merged 6 commits intomasterfrom
malformed_product_yaml
Apr 13, 2026
Merged

(fix) malformed YAML in SLES 16.1 product files#3378
mvidner merged 6 commits intomasterfrom
malformed_product_yaml

Conversation

@mvidner
Copy link
Copy Markdown
Contributor

@mvidner mvidner commented Apr 13, 2026

Problem

Solution

  • fix the syntax
  • .changes file

Testing

  • Tested manually
  • Added a new unit test to catch this sooner

Screenshots

No

Documentation

Do we need more docs? No, just more tests to catch it before the PR is merged.

Copy link
Copy Markdown
Contributor

@lslezak lslezak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use yq for YAML validation.

Comment thread .github/workflows/ci-products.yml Outdated

container:
# TODO: is this too much?
image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 context

It 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@mvidner
Copy link
Copy Markdown
Contributor Author

mvidner commented Apr 13, 2026

@lslezak the Ubuntu runner has Ruby, so I implemented the yq check and then reverted it. It's simpler with Ruby :)

mvidner added 6 commits April 13, 2026 17:33
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.
@mvidner mvidner force-pushed the malformed_product_yaml branch from 918de44 to 8c288c7 Compare April 13, 2026 15:35
Copy link
Copy Markdown
Contributor

@lslezak lslezak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mvidner mvidner merged commit d6b46ea into master Apr 13, 2026
21 checks passed
@mvidner mvidner deleted the malformed_product_yaml branch April 13, 2026 15:40
@imobachgs imobachgs mentioned this pull request Apr 14, 2026
imobachgs added a commit that referenced this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants