Skip to content

sg: Allow overwriting of sub-attributes through deep merging

Warren Gifford requested to merge mrn/sg-deep-merge into main

Created by: mrnugget

Given the following sg.config.yaml content:

commands:
  coolcommand:
    cmd: echo "this is the $COOL_ENV_1 and $COOL_ENV_2"
    install: echo "installing!"
    env:
      COOL_ENV_1: cool-env-1
      COOL_ENV_2: cool-env-2

And this in sg.config.overwrite.yaml:

commands:
  coolcommand:
    install: echo "new install command"
    env:
      COOL_ENV_2: overwritten-cool-env

then sg run coolcommand will print the following:

Installing coolcommand...
Successfully installed coolcommand
Running coolcommand...
[coolcommand] this is the cool-env-1 and overwritten-cool-env

Merge request reports

Loading