Project

General

Profile

Actions

action #59148

closed

Support YAML merge keys in Job Group Editor

Added by tinita over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Feature requests
Target version:
Start date:
2019-11-06
Due date:
% Done:

0%

Estimated time:
20.00 h

Description

The Job group editor is using YAML::XS, which does not support YAML merge keys, which allow you to merge several mappings into one:
https://yaml.org/type/merge.html

E.g.

---
defaults: &defaults
  a: 1
  b: 2
settings:
  <<: *defaults
  b: 22
  c: 3

There is currently only one module in perl supporting that: YAML::PP https://metacpan.org/pod/YAML::PP.
It allows to use libyaml as a parser backend via YAML::PP::LibYAML https://metacpan.org/pod/YAML::PP::LibYAML, so we can rely on the battle tested parsing of libyaml while using the features of the pure perl loader.

The only disadvantage is that YAML::PP is still pretty new and not yet "battle tested" like YAML::XS.

The advantage is, that YAML::PP adheres to the YAML 1.2 spec (regarding the schema, e.g. TRUE, True, true are booleans), while YAML::XS did only implement a small subset of YAML 1.1 types.
So it will be compatible to other YAML 1.2 processors.

The change in the code itself would be easy:

Instead of

my $data = YAML::XS::Load(...);

-->

my $yp = YAML::PP->new( schema => [qw/ + Merge /] );
my $data = $yp->load_string(...);

Checklist

  • Add YAML::PP (and poosibly YAML::PP::LibYAML) deps and submit them to Factory/Leap
  • Change code to use the new module
  • Add tests
  • Possibly check all existing templates if they can be parsed with the new module
  • Add documentation on how to use merge keys
  • Add a gerneral description for YAML 1.2 (e.g. which strings are special)

Related issues 1 (0 open1 closed)

Related to openQA Project - action #62603: Anchor/alias for hash map in job template settings in Job Groups YAML produces error Rejectedokurz2020-01-23

Actions
Actions

Also available in: Atom PDF