UNCLASSIFIED - NO CUI

Skip to content

Add basic values translation script, example 1.x defaults

Micah Nagel requested to merge 2-0-translate-script into master

General MR

Summary

Provides a basic values translation script for the main key changes for package names. The approach taken is:

  • basic checks to validate the values file provided exists, gnu-sed is present
  • sed replacement of core packages, replacing the first match where the line starts with the old name.
  • sed replacement of addon packages, replacing the first match where the line starts with any number of spaces + the old name.

Other approaches considered:

  • yq usage: yq does not have a great way to change a key. Effectively you need to create a new key (set equal to the old one) then delete the new one. This has weird effects on order in the file, and combined with the way yq strips out extra lines it makes for a messy script that doesn't really work.
  • Some hybrid yq/sed approach: Initially I wanted more "smarts" around editing the specific key, rather than just a regex match of what I think is the key. yq provides a way to get the line number for a key which seemed promising, but because of the way yq strips blank lines this proved to not be effective either.
  • Something else entirely: I considered looking at other available tools/options but given that this was meant to be a simple script that helps in some situations I decided to just settle with the sed approach.

Also adds an example 1.x default core package values file.

Edited by Micah Nagel

Merge request reports