1
votes

I have a pipeline where all the stages are test stages (no build stage, given that it is matlab code).

Most of the times when a stage fails, it is marked in red (failure) (e.g. in the blueocean pipeline graph), but sometimes all the stages are marked yellow (unstable), making it difficult to identify in what stage the things failed.

My question is, how does Jenkins determine if a stage is a build step (for which the result will be marked failure) or a test step (for which the result will be marked unstable)?

My goal is to always mark the stages as failed, not unstable, if they fail.

My stages are named as following:

stage('Check modified files')
  stage('Check examples (modified files)')
  stage('Unit testing (modified files)')
stage('Unit testing (dependent units/modules)')
1
The results of the job can be failure, successful or unstable , I guess it depends on the given steps / plugins what they will return on "fail" , try on your own manually force to setup status of pipeline, follow support.cloudbees.com/hc/en-us/articles/… , UNSTABLE should work as well, briefly a little more explanation Jenkins Pipeline Fails if Step is Unstablexxxvodnikxxx

1 Answers

1
votes

The documentation says

A build is broken if it failed during building. That is, it is not successful

and

A build is unstable if it was built successfully and one or more publishers report it unstable. For example, if the JUnit publisher is configured and a test fails then the build will be marked unstable.

To make Jenkins build failing on a test failure, you should setup Maven Surefire Plugin accordingly. The answer may be helpful https://stackoverflow.com/a/28684048/2443502. You can also try Fail The Build Jenkins plugin.