When I use MergedYamlMapping with overrideConflicts, the resulting YAML file loses all comments from the original YAML on merge. Without producing an entire example:
final YamlMapping updatedYaml = new MergedYamlMapping(oldYaml, newYaml, true);
System.out.println("OLD------------");
System.out.println(oldYaml.toString());
System.out.println("NEW------------");
System.out.println(newYaml.toString());
System.out.println("UPDATED--------");
System.out.println(updatedYaml.toString());
System.out.println("---------------");
Produces:
[INFO] OLD------------
[INFO] apiVersion: v2
name: Helm Chart Template
description: A Helm chart for Kubernetes
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: 0.0.0
[INFO] NEW------------
[INFO] name: Mock Java Back End Service
description: A mock Java (Quarkus) back end service project used as a sandbox for testing CI processes.
version: "0.0.2-SNAPSHOT"
appVersion: "0.0.2-SNAPSHOT"
[INFO] UPDATED--------
[INFO] apiVersion: v2
name: Mock Java Back End Service
description: A mock Java (Quarkus) back end service project used as a sandbox for testing CI processes.
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
version: "0.0.2-SNAPSHOT"
appVersion: "0.0.2-SNAPSHOT"
[INFO] ---------------
Note how the original has comments while the updated does not. The second you enable overrideConflicts, all comments are lost in the resulting merge on any item that is overridden.
When I use
MergedYamlMappingwithoverrideConflicts, the resulting YAML file loses all comments from the original YAML on merge. Without producing an entire example:Produces:
Note how the original has comments while the updated does not. The second you enable
overrideConflicts, all comments are lost in the resulting merge on any item that is overridden.