Configure VSTS to properly abort in case of errors

Christian Hujer 09/03/2018. 1 answers, 43 views
azure-devops azure-devops azure-pipelines

Given the following .vsts-ci.yml file

queue: Hosted Linux Preview

- script: |

The expected behavior and the actual behavior differ.

Expected behavior: Build fails at the false command, true will not be executed.

Actual behavior: Build succeeds, true is executed after the false command.


I would expect the VSTS build to fail on the first command false. However, VSTS executes the second command true as well and reports success. This means that the shell is setup incorrectly for build systems. The correct setup would be to have pipefail and errexit set. But it seems that errexit is not set, and probably pipefail isn't set either.

Is there a way to get the correct behavior, that is, pipefail and errexit, within the YAML file, without using bash -c in the scripts section? I know I can easily workaround by just moving the command sequence into a shell script or Makefile, I just want to know if there is a configuration possibility to get the YAML file execute shell commands in a shell with errexit and pipefail set, preferably a bash shell.

1 Answers

Christian Hujer 09/04/2018.

It seems that the bash shell created by VSTS does not have the pipefail and errexit flags set. See the following issue on GitHub about this:

But they can be set within the YAML file, like this:

queue: Hosted Linux Preview

- script: |
    set -e ; set -o pipefail
    true - Download Hi-Res Songs

1 Alan Walker

Different World flac

Alan Walker. 2018. Writer: Shy Nodi;Alan Walker;Fredrik Borch Olsen;James Njie;Marcus Arnbekk;Gunnar Greve Pettersen;K-391;Corsak;Shy Martin;Magnus Bertelsen.

Tell Me It's Over

3 Ariana Grande

​Thank U, Next flac

Ariana Grande. 2018. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
4 Mesto

Wait Another Day flac

Mesto. 2018.
5 Anne-Marie

Rewrite The Stars flac

Anne-Marie. 2018. Writer: Benj Pasek;Justin Paul.
6 Rita Ora

Let You Love Me flac

Rita Ora. 2018. Writer: Rita Ora;Easyfun;Fred Gibson;Noonie Bao;LotusIV;Ilsey Juber.
7 Conor Maynard

How You Love Me flac

Conor Maynard. 2018. Writer: Yoshi Breen;Thom Bridges;Hardwell;Rik Annema;Conor Maynard;Cimo Fränkel;Snoop Dogg.
8 Fitz And The Tantrums

HandClap flac

Fitz And The Tantrums. 2017. Writer: Fitz And The Tantrums;Eric Frederic;Sam Hollander.

There You Are flac

ZAYN. 2018. Writer: Joe Garrett;Levi Lennox;Michael Hannides;Anthony Hannides;ZAYN.
10 (G)I-DLE


(G)I-DLE. 2018. Writer: Riot Music Team;Harloe.
11 Clean Bandit

Baby flac

Clean Bandit. 2018. Writer: Jack Patterson;Kamille;Jason Evigan;Matthew Knott;Marina;Luis Fonsi.
12 Bastille

Grip flac

Bastille. 2018. Writer: Dan Smith;Espen Berg;Joakim Haukaas;Mark Crew;Simen Eriksrud;Thomas Eriksen.
13 Ariana Grande

Imagine flac

Ariana Grande. 2018. Writer: Jameel Roberts;Priscilla Renea;Happy Perez;Andrew "Pop" Wansel;Ariana Grande.
14 Mark Ronson

Nothing Breaks Like A Heart flac

Mark Ronson. 2018. Writer: Thomas Brenneck;Maxime Picard;Ilsey Juber;Conor Szymanski;Clement Picard;Mark Ronson;Miley Cyrus.

Good Years flac

ZAYN. 2018. Writer: Anthony Hannides;Khaled Rohaim;Michael Hannides;ZAYN;Herbie Crichlow.
16 The Chainsmokers

Beach House flac

The Chainsmokers. 2018. Writer: Andrew Taggart.
17 Clean Bandit

Mama flac

Clean Bandit. 2018. Writer: Jason Evigan;Jack Patterson;Grace Chatto;Ellie Goulding;Caroline Ailin.
18 Halsey

Without Me (Illenium Remix) flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.
19 Martin Garrix

Dreamer (Nicky Romero Remix) flac

Martin Garrix. 2018. Writer: Yury Parkhomenko;Aleksandr Parkhomenko;Ilsey Juber;Brian Lee;Mike Yung;Martin Garrix.
20 Julian Jordan

Glitch flac

Julian Jordan. 2018.

Related questions

Hot questions


Popular Tags