How to remove inherit property from yaml config?

I have a yaml file:

local: &local
  image: xxx
  # *tons of config*

ci:
  <<: *local
  image: # delete
  build: .

I want to ciinherit all values ​​from localexcept image.

Is there a way to "delete" this value?

+4
source share
1 answer

There is no way to mark keyfor deletion in a YAML file. You can overwrite existing values .

And the last thing you do is map the empty scalar as a value to the key image, as if you wrote:

  image: null   # delete

There are two things you can do: a post process or creating a basic mapping in your YAML file.

-, image , , - . , , , .

, YAML:

localbase: &lb
  # *tons of config*

local: &local
  image: xxx

ci:
  <<: *lb
  build: .

, , , " " ( ruamel.yaml), "-", local . , , .

+5

Source: https://habr.com/ru/post/1662721/


All Articles