kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.53k stars 81 forks source link

Resolving anchor references broken in yq 3.x #149

Closed skahlhoefer closed 2 years ago

skahlhoefer commented 2 years ago

With the freshly released yq 3.0.1, wee're experiencing an issue while processing a YAML file which includes anchors and references. The resolution of such references seems to no longer work in version 3. YAML File env.yml excerpt:

constants: &constants
  PROFILE_PREFIX: "abc-def"
  REGION: "eu-1"

dev:
  <<: *constants
  STAGE_ID: "123456"

All works well and as expected with yq 2.14.0:

$> yq --version
yq 2.14.0
$> cat env.yml | yq -r .dev
{
  "PROFILE_PREFIX": "abc-def",
  "REGION": "eu-1",
  "STAGE_ID": "123456"
}

With yq 3.0.1 unfortunately not:

$> yq --version
yq 3.0.1
$> cat env.yml | yq -r .dev   
{
  "<<": {
    "PROFILE_PREFIX": "abc-def",
    "REGION": "eu-1"
  },
  "STAGE_ID": "123456"
}
kislyuk commented 2 years ago

Thanks for reporting. Fixed in v3.0.2.