circleci-cli icon indicating copy to clipboard operation
circleci-cli copied to clipboard

Support anchors and aliases across YAML files in decomposed orbs

Open mcafaro opened this issue 4 years ago • 10 comments

  • [x] I have read Contribution Guidelines.
  • [x] I have checked for similar issues and haven't found anything relevant.
  • [x] This is not a security issue (which should be reported here: https://circleci.com/security/)

Do you want to request a feature or report a bug? Request a feature.

What is the current behavior? circleci config pack produces an "unknown anchor" error when attempting to define a YAML anchor in one file and alias it in another.

Can you provide an example?

Example directory structure:

my-orb/src/
├ anchors
│ └ @anchors.yml
└ commands
  └ my-command.yml

@anchors.yml:

my-anchor: &my-anchor my-value

my-command.yml:

description: *my-anchor

running circleci config pack:

> circleci config pack src
Error: Failed trying to marshal the tree to YAML : yaml: unknown anchor 'my-anchor' referenced

What is the expected behavior?

running circleci config pack:

> circleci config pack src
anchors:
  my-anchor: my-value
commands:
  my-command:
    description: my-value

Which version of the CLI and OS are you using? Did this work in previous versions?

> circleci version
0.1.5879+416032d

I am not aware of a version where this ever worked.

mcafaro avatar Oct 09 '19 15:10 mcafaro

Is there any progress on this? Especially big config files, like ours (> 1000 lines) need both, packaging and working anchors.

valentinsavenko avatar Jan 03 '20 15:01 valentinsavenko

cc @KunalJain

marcomorain avatar Mar 10 '20 12:03 marcomorain

Digging a little deeper into this, although it's unlikely I'll be able to get around to implementing it until #432 is complete.

gmemstr avatar Jun 16 '20 12:06 gmemstr

Is there any workaround for this as of today? 🤔

alessandroberlati avatar Mar 01 '21 22:03 alessandroberlati

Hello! Just wanted to see if there was any update on this? 😊

I have a workaround where I do some manual preprocessing for merging aliases/anchors but it's a bit messy 🤷‍♂️ Would be super cool if this was able to become a builtin feature!

joshdholtz avatar Feb 19 '22 01:02 joshdholtz

Hello do you have any advance regarding this? Im facing the same issue

juanpciceri avatar Jul 01 '22 17:07 juanpciceri

That's sad to tell people to upgrade and use pack but also loosing this ability. Is there any tips or direction that could be provided by CircleCI's team, so maybe one of us could implement it?

At least let us use include() for anchors files. :)

benoittgt avatar Oct 05 '22 18:10 benoittgt

Also facing the same issue. Any updates on this? Thank you!

klaukl avatar Mar 23 '23 03:03 klaukl

Any updates? I also want to know how to support the context/anchors declaration when executing the circleci config pack.

Jinxiansen avatar Sep 17 '23 13:09 Jinxiansen

Digging a little deeper into this, although it's unlikely I'll be able to get around to implementing it until #432 is complete.

this was merged over 3 years ago, can this be worked on sometime?

KevinAnthony avatar Jan 25 '24 18:01 KevinAnthony