payload: {"action":"created","issue":{"url":"https://api.github.com/repos/cirruslabs/cirrus-ci-docs/issues/413","repository_url":"https://api.github.com/repos/cirruslabs/cirrus-ci-docs","labels_url":"https://api.github.com/repos/cirruslabs/cirrus-ci-docs/issues/413/labels{/name}","comments_url":"https://api.github.com/repos/cirruslabs/cirrus-ci-docs/issues/413/comments","events_url":"https://api.github.com/repos/cirruslabs/cirrus-ci-docs/issues/413/events","html_url":"https://github.com/cirruslabs/cirrus-ci-docs/issues/413","id":478320382,"node_id":"MDU6SXNzdWU0NzgzMjAzODI=","number":413,"title":"[Prio High] Merging YAML maps via anchors are applied in incorrect order","user":{"login":"geekflyer","id":1221897,"node_id":"MDQ6VXNlcjEyMjE4OTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1221897?v=4","gravatar_id":"","url":"https://api.github.com/users/geekflyer","html_url":"https://github.com/geekflyer","followers_url":"https://api.github.com/users/geekflyer/followers","following_url":"https://api.github.com/users/geekflyer/following{/other_user}","gists_url":"https://api.github.com/users/geekflyer/gists{/gist_id}","starred_url":"https://api.github.com/users/geekflyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geekflyer/subscriptions","organizations_url":"https://api.github.com/users/geekflyer/orgs","repos_url":"https://api.github.com/users/geekflyer/repos","events_url":"https://api.github.com/users/geekflyer/events{/privacy}","received_events_url":"https://api.github.com/users/geekflyer/received_events","type":"User","site_admin":false},"labels":[{"id":744794389,"node_id":"MDU6TGFiZWw3NDQ3OTQzODk=","url":"https://api.github.com/repos/cirruslabs/cirrus-ci-docs/labels/bug","name":"bug","color":"ee0701","default":true},{"id":1258179701,"node_id":"MDU6TGFiZWwxMjU4MTc5NzAx","url":"https://api.github.com/repos/cirruslabs/cirrus-ci-docs/labels/high-priority","name":"high-priority","color":"8621ce","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2019-08-08T08:20:43Z","updated_at":"2019-08-20T04:20:16Z","closed_at":"2019-08-09T23:13:43Z","author_association":"CONTRIBUTOR","body":"When using YAML Anchors and merging a YAML map into another map, the merge happens in the incorrect order.\r\n\r\nConsider this example:\r\n\r\n```yaml\r\notherEnv: &otherEnv\r\n  foo: baz\r\n\r\ntask:\r\n  env:\r\n    <<: *otherEnv\r\n    foo: bar\r\n  script: echo $foo\r\n```\r\n\r\nThis prints: `baz`.\r\n\r\nWhat I would expect: `bar`.\r\n\r\nI.e. In the `env` section where I merge the yaml maps, the last occurrence of a key should always win. This is the spec compliant behavior in JavaScript and JSON parsers and a quick check on [https://yaml-online-parser.appspot.com/](https://yaml-online-parser.appspot.com/?yaml=otherEnv%3A+%26otherEnv%0A++foo%3A+baz%0A%0Atask%3A%0A++env%3A%0A++++%3C%3C%3A+*otherEnv%0A++++foo%3A+bar%0A++script%3A+echo+%24foo&type=json) (which is supposedly yaml 1.2) yields the same result.\r\n\r\nIn cirrus ci the merging behaviour is exactly the other way around.\r\nIf I change\r\n```yaml\r\n  env:\r\n    <<: *otherEnv\r\n    foo: bar\r\n```\r\nto\r\n```yaml\r\n  env:\r\n    foo: bar\r\n    <<: *otherEnv\r\n```\r\nI sort of get the \"expected\" output (`bar`) which very surprising.\r\n\r\nSince this behaviour can lead to very weird, hard to debug and accidental surprises (i.e. deploying to the wrong environment or applying incorrect configs) I consider this a high priority to get fixed.\r\n\r\nThanks :)\r\n"},"comment":{"url":"https://api.github.com/repos/cirruslabs/cirrus-ci-docs/issues/comments/522846542","html_url":"https://github.com/cirruslabs/cirrus-ci-docs/issues/413#issuecomment-522846542","issue_url":"https://api.github.com/repos/cirruslabs/cirrus-ci-docs/issues/413","id":522846542,"node_id":"MDEyOklzc3VlQ29tbWVudDUyMjg0NjU0Mg==","user":{"login":"fkorotkov","id":989066,"node_id":"MDQ6VXNlcjk4OTA2Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/989066?v=4","gravatar_id":"","url":"https://api.github.com/users/fkorotkov","html_url":"https://github.com/fkorotkov","followers_url":"https://api.github.com/users/fkorotkov/followers","following_url":"https://api.github.com/users/fkorotkov/following{/other_user}","gists_url":"https://api.github.com/users/fkorotkov/gists{/gist_id}","starred_url":"https://api.github.com/users/fkorotkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fkorotkov/subscriptions","organizations_url":"https://api.github.com/users/fkorotkov/orgs","repos_url":"https://api.github.com/users/fkorotkov/repos","events_url":"https://api.github.com/users/fkorotkov/events{/privacy}","received_events_url":"https://api.github.com/users/fkorotkov/received_events","type":"User","site_admin":false},"created_at":"2019-08-20T04:20:16Z","updated_at":"2019-08-20T04:20:16Z","author_association":"CONTRIBUTOR","body":"Can reproduce in tests. Will fix it. 👌"}}
other: {"actor":{"display_login":"fkorotkov"}}