Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit pipelines when a command fails (bash) #1174

Closed
epassaro opened this issue May 28, 2020 · 3 comments
Closed

Exit pipelines when a command fails (bash) #1174

epassaro opened this issue May 28, 2020 · 3 comments

Comments

@epassaro
Copy link
Member

epassaro commented May 28, 2020

Currently a when running a bash task on Azure Pipelines the succeeded or failed status is determined by the exit code of the last command (See #1162 for example).

Suggestion

Would be nice to make steps fail if any command fails by setting the SHELLOPTS=errexit variable across the entire job. Prepending this step to all pipelines should work:

      - bash:  echo "##vso[task.setvariable variable=shellopts]errexit"
        displayName: "Force exit on error (bash)"

See also:

@epassaro
Copy link
Member Author

epassaro commented Jul 1, 2020

Have this in mind @kaushik94.

@kaushik94
Copy link
Contributor

@epassaro
Copy link
Member Author

epassaro commented Jul 9, 2020

As @kaushik94 proved, this piece of code works just fine! See: #1210.

Closed.

@epassaro epassaro closed this as completed Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants