# Support referenced workflows inside a bitrise.yml

**URL:** <https://discuss.bitrise.io/t/support-referenced-workflows-inside-a-bitrise-yml/11772>\
**Category:** Website\
**Created:** [January 30, 2020, 10:20pm UTC](https://discuss.bitrise.io/t/support-referenced-workflows-inside-a-bitrise-yml/11772 "2020-01-30T22:20:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![damien.murphy](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/damien.murphy/32/4535_2.png) [@damien.murphy](https://discuss.bitrise.io/u/damien.murphy)\
**Post date:** [January 30, 2020, 10:20pm UTC](https://discuss.bitrise.io/t/support-referenced-workflows-inside-a-bitrise-yml/11772/1 "2020-01-30T22:20:57Z")

</div>

## Description of the feature request

Allow yml files to be referenced as workflows within the bitrise.yml

For example the “\_setup” workflow would not be inlined in every workflow’s bitrise.yml and could be referenced using a relative path.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/1/13126b1f18400d7101240208085412885a2163c0.png)

## Use case / for what or how I would use it

When using GitHub + Bitrise API to manage a large number of workflows changing the \_setup workflow must be changed in every bitrise.yml.

This would make managing Bitrise at scale much easier and allow for updating and tracking changes to yml files much easier

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 31, 2020, 9:26am UTC](https://discuss.bitrise.io/t/support-referenced-workflows-inside-a-bitrise-yml/11772/2 "2020-01-31T09:26:40Z")

</div>

But where would the `_setup.yml` live? 🤔 I mean if this is to "manage a large number of workflows " that implies those live in separate repositories too, right?

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 31, 2020, 9:29am UTC](https://discuss.bitrise.io/t/support-referenced-workflows-inside-a-bitrise-yml/11772/3 "2020-01-31T09:29:47Z")

</div>

I do agree with the intent though, we see this issue as well, ideally we could have one repo which is like a “module” repo (if you used `terraform` modules before, which are reusable components similar to our steps) that could include multiple modules (reusable workflows) which could be referenced in other projects (which live in a separate repository).

This’d mean that the workflow referencing should support specifying the “modules”/“workflows” repository too 🤔 or of course you could just have that other repo as a submodule or such, but that seems to be a bit more hassle to setup.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 31, 2020, 9:31am UTC](https://discuss.bitrise.io/t/support-referenced-workflows-inside-a-bitrise-yml/11772/4 "2020-01-31T09:31:35Z")

</div>

Terragrunt’s similar feature [https://terragrunt.gruntwork.io/docs/features/keep-your-terraform-code-dry/](https://terragrunt.gruntwork.io/docs/features/keep-your-terraform-code-dry/)

---

<div class="post-metadata">

**Author:** ![cobbal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/cobbal/32/2616_2.png) [@cobbal](https://discuss.bitrise.io/u/cobbal)\
**Post date:** [January 31, 2020, 5:43pm UTC](https://discuss.bitrise.io/t/support-referenced-workflows-inside-a-bitrise-yml/11772/5 "2020-01-31T17:43:39Z")

</div>

The workaround I used for this was to (ab)use yaml anchors.

In one workflow:

```
steps:
  - &install-tools
    script:
      inputs: [lots of stuff]
  - &carthage
    carthage:
      inputs: [stuff]
...
steps:
  - *install-tools
  - *carthage

```

Not perfect, but it helps keep things DRY

---

<div class="post-metadata">

**Author:** ![damien.murphy](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/damien.murphy/32/4535_2.png) [@damien.murphy](https://discuss.bitrise.io/u/damien.murphy)\
**Post date:** [January 31, 2020, 11:04pm UTC](https://discuss.bitrise.io/t/support-referenced-workflows-inside-a-bitrise-yml/11772/6 "2020-01-31T23:04:09Z")

</div>

Non-bitrise.yml files could be stored anywhere so long as they can be updated via api and referenced inside a bitrise.yml.

One folder you from every bitrise.yml should make it easier to manage
