# Imported config results in out of order build stages despite order explicitly specified

**URL:** <https://travis-ci.community/t/imported-config-results-in-out-of-order-build-stages-despite-order-explicitly-specified/9290>\
**Category:** Early Releases\
**Tags:** build-stages, config-import\
**Created:** [July 8, 2020, 1:35pm UTC](https://travis-ci.community/t/imported-config-results-in-out-of-order-build-stages-despite-order-explicitly-specified/9290 "2020-07-08T13:35:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwhswenson](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dwhswenson/32/4869_2.png) [@dwhswenson](https://travis-ci.community/u/dwhswenson)\
**Post date:** [July 8, 2020, 1:35pm UTC](https://travis-ci.community/t/imported-config-results-in-out-of-order-build-stages-despite-order-explicitly-specified/9290/1 "2020-07-08T13:35:16Z")

</div>

I’m still seeing this problem, even with order defined in `stages`.

Context: I have a set of imported configs (part of [https://github.com/dwhswenson/autorelease/](https://github.com/dwhswenson/autorelease/)) that I use to do very careful PyPI releases in my projects. The cycle goes like this:

PR to master: Stages: `test`  
PR to stable: Stages: `test` -\> `deploy_testpypi` -\> `test_testpypi`  
Merge to stable: Stages: `test` -\> `cut_release` (new GitHub release)  
New release (version tag): Stages: `test` -\> `deploy_pypi`

There’s a main (user-facing) import at `dwhswenson/autorelease:autorelease-travis.yml`, which then imports each stage individually. When I do a PR to stable, the order is incorrect. It tries to do the `test_testpypi` before `deploy_testpypi`. (Note that by manually forcing the `deploy_testpypi` to run once, tests will pass. But this is not how it should work!)

Things I tried:

- Putting `stages` in the main imported file, after importing the second-level imports: [https://travis-ci.com/github/dwhswenson/contact\_map/builds/174797763](https://travis-ci.com/github/dwhswenson/contact_map/builds/174797763)
- Putting `stages` in the main imported file, before importing second-level imports: [https://travis-ci.com/github/dwhswenson/contact\_map/builds/174802702](https://travis-ci.com/github/dwhswenson/contact_map/builds/174802702)
- Putting `stages` in the root `.travis.yml` (while it was also in the imports): [https://travis-ci.com/github/dwhswenson/contact\_map/builds/174802899](https://travis-ci.com/github/dwhswenson/contact_map/builds/174802899)

In all cases, the `stages` parameter shows up in the config JSON, with the correct ordering of `deploy_testpypi` and `test_testpypi` (in fact, the last version, with `stages` both imported and defined locally, lists the whole sequence twice). In all cases, the requested order is not used by Travis.

Note that this set of configs used to work fine. I assume this is the result of the same change the OP noticed (last time I did a release was before then).

---

<div class="post-metadata">

**Author:** ![dwhswenson](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dwhswenson/32/4869_2.png) [@dwhswenson](https://travis-ci.community/u/dwhswenson)\
**Post date:** [August 12, 2020, 6:31am UTC](https://travis-ci.community/t/imported-config-results-in-out-of-order-build-stages-despite-order-explicitly-specified/9290/2 "2020-08-12T06:31:45Z")

</div>

Looks like it was my error. In the explicit stage ordering, I used underscores, whereas apparently I had spaces in the actual stage names.

That said, there was no warning in the build config validation. May there could be a validation test that the stages a user lists actually exist?
