# Shared Config and Anchors

**URL:** https://travis-ci.community/t/shared-config-and-anchors/8784
**Category:** Early Releases
**Created:** [May 27, 2020, 6:09pm UTC](https://travis-ci.community/t/shared-config-and-anchors/8784 "2020-05-27T18:09:31Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![hhslepicka](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/hhslepicka/32/4664_2.png) [@hhslepicka](https://travis-ci.community/u/hhslepicka)
#### Post date: [May 27, 2020, 6:09pm UTC](https://travis-ci.community/t/shared-config-and-anchors/8784/1 "2020-05-27T18:09:31Z")

</div>

Is it possible to create and use anchors via the new shared configs mechanism?

---

<div class="post-metadata">

### Author: ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)
#### Post date: [May 28, 2020, 7:46am UTC](https://travis-ci.community/t/shared-config-and-anchors/8784/2 "2020-05-28T07:46:45Z")

</div>

Hey @hhslepicka,

Welcome! Have you looked at this?

> **[Travis CI Documentation](https://docs.travis-ci.com/user/build-config-yaml)**
>
> Using YAML as a build configuration language

---

<div class="post-metadata">

### Author: ![hhslepicka](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/hhslepicka/32/4664_2.png) [@hhslepicka](https://travis-ci.community/u/hhslepicka)
#### Post date: [May 28, 2020, 10:36am UTC](https://travis-ci.community/t/shared-config-and-anchors/8784/3 "2020-05-28T10:36:33Z")

</div>

Hey @Montana,  
Thank you!

Yes, I looked into that.  
What I would like to do is to leverage the new shared config at Travis with the import mechanisms and import existing anchors at my .travis.yml file or even other shared configs but unfortunately that does not seem possible at least at my tests.

The files are imported but the anchor is never properly replaced as I believe it is evaluated when the file is loaded and before joining the templates.  
Is that correct?

Is there a way around it?

---

<div class="post-metadata">

### Author: ![hhslepicka](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/hhslepicka/32/4664_2.png) [@hhslepicka](https://travis-ci.community/u/hhslepicka)
#### Post date: [June 1, 2020, 12:44am UTC](https://travis-ci.community/t/shared-config-and-anchors/8784/4 "2020-06-01T00:44:49Z")

</div>

@Montana do you happen to have a way around the usage of anchors coming from files imported via the new shared config mechanism?

What I would like to do is to define standard procedures at yaml files that later can be reused and imported to compose a .travis.yml with those common anchors.

---

<div class="post-metadata">

### Author: ![roman.hosek](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/roman.hosek/32/5244_2.png) [@roman.hosek](https://travis-ci.community/u/roman.hosek)
#### Post date: [September 29, 2020, 3:47pm UTC](https://travis-ci.community/t/shared-config-and-anchors/8784/5 "2020-09-29T15:47:58Z")

</div>

Unfortunately, it’s not supported:

> [@Imported anchors not working](https://travis-ci.community/t/imported-anchors-not-working/10035/2):
>
> This is not supported. [Anchors and aliases are an internal detail in YAML 1.1 – when a YAML is parsed, all aliases are expanded using corresponding anchors and neither are present in the parse result.](https://yaml.org/spec/1.1/current.html#id863390) Travis combines parse trees rather than raw text (since it needs to parse the file to find out whether it needs to import anything) so it cannot do anything about anchors at that point.
