Simone Gaiarin
Simone Gaiarin

Reputation: 350

How does Jenkins determine if a stage in the pipeline is a build step or a test step?

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)')

Upvotes: 2

Views: 1899

Answers (1)

Marcin Kłopotek
Marcin Kłopotek

Reputation: 5931

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.

Upvotes: 2

Related Questions