# Work out kinks in interactions between stages, allow\_fail, and fast\_finish

**URL:** <https://travis-ci.community/t/work-out-kinks-in-interactions-between-stages-allow-fail-and-fast-finish/1090>\
**Category:** Feature Requests\
**Tags:** bug, build-stages\
**Created:** [November 27, 2018, 6:34pm UTC](https://travis-ci.community/t/work-out-kinks-in-interactions-between-stages-allow-fail-and-fast-finish/1090 "2018-11-27T18:34:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonhoo](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/jonhoo/32/574_2.png) [@jonhoo](https://travis-ci.community/u/jonhoo)\
**Post date:** [November 27, 2018, 6:34pm UTC](https://travis-ci.community/t/work-out-kinks-in-interactions-between-stages-allow-fail-and-fast-finish/1090/1 "2018-11-27T18:34:40Z")

</div>

In the Rust library [`imap`](https://github.com/jonhoo/rust-imap), I’m [looking to](https://github.com/jonhoo/rust-imap/pull/105) reduce the time it takes to get results from CI. My plan was to use a combination of build stages, `allow_fail`, and `fast_finish`. The result looks like this: [https://github.com/jonhoo/rust-imap/blob/562b77255c61cd1cf813b8034d1c3d3d1325f582/.travis.yml](https://github.com/jonhoo/rust-imap/blob/562b77255c61cd1cf813b8034d1c3d3d1325f582/.travis.yml)

Some noteworthy things:

- `fast_finish` is [enabled for all jobs](https://github.com/jonhoo/rust-imap/blob/562b77255c61cd1cf813b8034d1c3d3d1325f582/.travis.yml#L30).
- Builds on Windows [are allowed to fail](https://github.com/jonhoo/rust-imap/blob/562b77255c61cd1cf813b8034d1c3d3d1325f582/.travis.yml#L40) (mostly because they take forever to run, and I don’t want to wait for them)
- The last build stage, “coverage”, has only [a single job](https://github.com/jonhoo/rust-imap/blob/562b77255c61cd1cf813b8034d1c3d3d1325f582/.travis.yml#L101), and it is [allowed to fail](https://github.com/jonhoo/rust-imap/blob/562b77255c61cd1cf813b8034d1c3d3d1325f582/.travis.yml#L44).

I tried to use that `.travis.yml` file, and ended up with [this build](https://travis-ci.org/jonhoo/rust-imap/builds/459508822). Two things seem to go wrong:

- In the “test” stage, when all jobs but the Windows one had completed, Travis did _not_ move on to the next stage (“integration”). Instead, it was waiting for the Windows job to finish. I cancelled the Windows job, and then the next stage was immediately started. I then re-started the Windows job, and then Travis again waited for it to complete before it continued to the “lint” stage. I believe this is [GH issue #9677](https://github.com/travis-ci/travis-ci/issues/9677).
- The last stage with only one job (“coverage”) takes a while to run (~16m without cache), and is allowed to fail. However, the build was not marked as successful once the last of the jobs in the “lint” stage succeeded. Furthermore, when I cancelled the coverage job, the entire build was marked as cancelled, not successful as I would have expected given that the last remaining job was marked `allow_fail`. I’ve filed this as [GH issue #10356](https://github.com/travis-ci/travis-ci/issues/10356).

---

<div class="post-metadata">

**Author:** ![mkurz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/mkurz/32/578_2.png) [@mkurz](https://travis-ci.community/u/mkurz)\
**Post date:** [November 27, 2018, 7:49pm UTC](https://travis-ci.community/t/work-out-kinks-in-interactions-between-stages-allow-fail-and-fast-finish/1090/2 "2018-11-27T19:49:20Z")

</div>

> [@jonhoo](#):
>
> Furthermore, when I cancelled the coverage job, the entire build was marked as cancelled, not successful as I would have expected given that the last remaining job was marked `allow_fail`

+1 Same here.

---

<div class="post-metadata">

**Author:** ![jonhoo](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/jonhoo/32/574_2.png) [@jonhoo](https://travis-ci.community/u/jonhoo)\
**Post date:** [December 5, 2018, 2:41pm UTC](https://travis-ci.community/t/work-out-kinks-in-interactions-between-stages-allow-fail-and-fast-finish/1090/3 "2018-12-05T14:41:49Z")

</div>

Now that [#9677](https://github.com/travis-ci/travis-ci/issues/9677) has also been closed, this probably also becomes the tracking issue for that. Namely that Travis does not advance to next build stage when `fast_finish: true`.

---

<div class="post-metadata">

**Author:** ![mmcc007](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/mmcc007/32/1443_2.png) [@mmcc007](https://travis-ci.community/u/mmcc007)\
**Post date:** [March 25, 2019, 11:26pm UTC](https://travis-ci.community/t/work-out-kinks-in-interactions-between-stages-allow-fail-and-fast-finish/1090/4 "2019-03-25T23:26:40Z")

</div>

+1 I’m getting the same thing:  
[https://travis-ci.org/mmcc007/flutter\_architecture\_samples/builds/510839158](https://travis-ci.org/mmcc007/flutter_architecture_samples/builds/510839158)  
Does this also happen with matrices?

(In my case, since no longer depend on stages, I may be able to switch from stages to a matrix.)

---

<div class="post-metadata">

**Author:** ![nurupo](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/nurupo/32/2212_2.png) [@nurupo](https://travis-ci.community/u/nurupo)\
**Post date:** [May 4, 2019, 6:41am UTC](https://travis-ci.community/t/work-out-kinks-in-interactions-between-stages-allow-fail-and-fast-finish/1090/5 "2019-05-04T06:41:27Z")

</div>

> In the “test” stage, when all jobs but the Windows one had completed, Travis did _not_ move on to the next stage (“integration”). Instead, it was waiting for the Windows job to finish. I cancelled the Windows job, and then the next stage was immediately started. I then re-started the Windows job, and then Travis again waited for it to complete before it continued to the “lint” stage.

By design, only one stage is allowed to run at a time. That what stages are. They run in sequence, one at a time. Even if the only remaining job in a stage has `allow_failure` set, the next stage will not start until that job is finished. That’s the correct and expected behavior.

---

<div class="post-metadata">

**Author:** ![mvz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/mvz/32/1100_2.png) [@mvz](https://travis-ci.community/u/mvz)\
**Post date:** [October 18, 2019, 9:36am UTC](https://travis-ci.community/t/work-out-kinks-in-interactions-between-stages-allow-fail-and-fast-finish/1090/6 "2019-10-18T09:36:28Z")

</div>

Maybe this should be split since there are two or maybe even three issues:

- Stages wait even if only allow\_failures jobs are running
- Build is not marked successful even if only allow\_failures jobs are left
- Canceling an allow\_failures job makes the entire build fail

(I came here because I also have the third issue)
