You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the path-filtering orb to merge multiple configs, some of which contain yaml anchors such as the one below,
default_vars: &default_varsenvironment:
DEBUG: trueNODE_ENV: production
the anchors are sometimes placed at the bottom of the merged config which causes the build to fail with an error message similar to:
Unable to parse YAML
found undefined alias default
in 'string', line 471, column 9:
<<: *default_vars
^
Note: If only a single config contains anchors then this issue appears to happen sporadically depending on the order that the filtered configs are processed in. In other words, if we have 2 configs, config_1_with_anchors.yml and config_2_without_anchors.yml, if the merging code decides to process config_1_with_anchors.yml before config_2_without_anchors.yml it works just fine. If on the other hand it decides to process config_2_without_anchors.yml first and config_1_with_anchors.yml second then it fails. The order of processing appears to be non-deterministic.
Expected behavior:
Ideally YAML anchors should always be placed at the top of the merged config so that they do not cause parsing errors.
Additional context:
Here's a sample .circleci/config.yml file which reproduces the issue above:
elijahe
changed the title
YAML Anchors Randomly Ordered When Configs are Merged
YAML Anchors Randomly Ordered When Configs are Merged Causing Build Failures
Jan 3, 2024
elijahe
changed the title
YAML Anchors Randomly Ordered When Configs are Merged Causing Build Failures
YAML Anchors Causing Build Failures
Jan 3, 2024
Hey @elijahe, thank you for reporting the issue! I'm experiencing the same problem. Have you found any solutions to avoid this error, other than consolidating the configuration into a single one?
Hi @patrykkarny , no I haven't found a solution for this issue yet. We're just avoiding YAML Anchors for now. It would be great to be able to use them again.
Orb version:
1.0.0
What happened:
When using the
path-filtering
orb to merge multiple configs, some of which contain yaml anchors such as the one below,the anchors are sometimes placed at the bottom of the merged config which causes the build to fail with an error message similar to:
Note: If only a single config contains anchors then this issue appears to happen sporadically depending on the order that the filtered configs are processed in. In other words, if we have 2 configs,
config_1_with_anchors.yml
andconfig_2_without_anchors.yml
, if the merging code decides to processconfig_1_with_anchors.yml
beforeconfig_2_without_anchors.yml
it works just fine. If on the other hand it decides to processconfig_2_without_anchors.yml
first andconfig_1_with_anchors.yml
second then it fails. The order of processing appears to be non-deterministic.Expected behavior:
Ideally YAML anchors should always be placed at the top of the merged config so that they do not cause parsing errors.
Additional context:
Here's a sample
.circleci/config.yml
file which reproduces the issue above:The text was updated successfully, but these errors were encountered: