# Build config imports: Merging \`deploy\` array and objects

**URL:** <https://travis-ci.community/t/build-config-imports-merging-deploy-array-and-objects/8161>\
**Category:** Feature Requests\
**Tags:** travis-yml, config-import\
**Created:** [April 15, 2020, 7:57am UTC](https://travis-ci.community/t/build-config-imports-merging-deploy-array-and-objects/8161 "2020-04-15T07:57:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankon](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/ankon/32/944_2.png) [@ankon](https://travis-ci.community/u/ankon)\
**Post date:** [April 15, 2020, 7:57am UTC](https://travis-ci.community/t/build-config-imports-merging-deploy-array-and-objects/8161/1 "2020-04-15T07:57:39Z")

</div>

When working on moving our builds to use the build config imports (see also [Experience report: Sharing complex build configuration](https://travis-ci.community/t/experience-report-sharing-complex-build-configuration/7814)) I noticed that our `deploy` sections didn’t merge nicely.

In the shared config I had

```auto
deploy:
  provider: script
  script: "travis-deploy ${DOCKER_NAME} ${TAGS}"
  on:
    all_branches: true

```

In the importing config I had:

```auto
import:
- source: shared-config.yml
  mode: deep_merge_prepend

deploy:
- provider: npm
  ...

```

I somehow expected either both `deploy`s to be present in the merged configuration, or a warning/error that these are not mergeable (note one of them is an array, one is an object!).

What happened instead was that just the npm deployment got used, and the script deployment from the shared configuration was dropped silently.

Fix/Workaround after spotting the difference in types: Convert the shared configuration `deploy` to use an array as well.

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [April 15, 2020, 4:18pm UTC](https://travis-ci.community/t/build-config-imports-merging-deploy-array-and-objects/8161/2 "2020-04-15T16:18:15Z")

</div>

It’s not as clear cut what the “intuitive” way of action would be here.

E.g. if there was another `npm` provider entry the original, it’s possible that you would rather wish to replace it.

So the best action in my book is to follow [Python Zen](https://www.python.org/dev/peps/pep-0020/), koan 12, and produce a warning.

---

<div class="post-metadata">

**Author:** ![ankon](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/ankon/32/944_2.png) [@ankon](https://travis-ci.community/u/ankon)\
**Post date:** [April 15, 2020, 4:29pm UTC](https://travis-ci.community/t/build-config-imports-merging-deploy-array-and-objects/8161/3 "2020-04-15T16:29:53Z")

</div>

> [@native-api](#):
>
> So the best action in my book is to follow [Python Zen](https://www.python.org/dev/peps/pep-0020/), koan 12, and produce a warning.

Absolutely agree with you here: I as human can perfectly well fix this issue, but I would certainly appreciate the system to help me by pointing to it.

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [April 15, 2020, 4:35pm UTC](https://travis-ci.community/t/build-config-imports-merging-deploy-array-and-objects/8161/4 "2020-04-15T16:35:56Z")

</div>

So, what we are actually lacking here is warnings from the config merge logic!

Since the import feature [comes bundled with config validation](https://docs.travis-ci.com/user/build-config-imports/#opt-in), it looks like the simplest solution to feed them into the validation results.
