54

I am running Jenkins version 1.411 and use Maven for building.

Even though the application builds successfully, Jenkins treats it as an unstable build. I have disabled all tests to isolate the problem.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.389s
[INFO] Finished at: Wed May 11 12:16:57 EST 2011
[INFO] [DocLinks] Skip document Adaptiv generated site ... (No such directory: site)
Final Memory: 27M/543M
[INFO] ------------------------------------------------------------------------
channel stopped
Archiving artifacts
Email was triggered for: Unstable
Sending email for trigger: Unstable
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: SUCCESS
Croydon Dias
  • 1,906
  • 5
  • 20
  • 27
  • 1
    Sorry but this question phrasing is a non-sense. An unstable build is always a failed build. You are confusing the maven "BUILD SUCCESS" output message with Jenkins status which are a very different thing. – sorin Jun 05 '18 at 13:32
  • 6
    @sorin: You comment does not appear to be in line with the [Jenkins Terminology](https://wiki.jenkins.io/display/JENKINS/Terminology), which explicitly states "A build is unstable if it was built successfully and one or more publishers report it unstable" and "A build is broken if it failed during building. That is, it is not successful." – Martin J.H. Feb 07 '19 at 07:48

2 Answers2

69

It's some time ago that I used hudson/jenkins but you should have a look at the Jenkins Glossary

Unstable build: 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.

Publisher: A publisher is part of the build process other than compilation, for example JUnit test runs. A publisher may report stable or unstable result depending on the result of its processing. For example, if a JUnit test fails, then the whole JUnit publisher may report unstable.

So I suppose you have some other build parts (apart from JUnit) that report an unstable result. Have a look at the whole build process log.

FrVaBe
  • 47,963
  • 16
  • 124
  • 157
  • Found out that it was the DocLinks plugin which was giving me trouble. It was set to host the site folder generated by maven. But since the target folder is cleaned before each build, it could not resolve the path. Opened an issue over [here](https://github.com/jenkinsci/doclinks-plugin/issues/1#comment_1139367) – Croydon Dias May 12 '11 at 12:19
  • 4
    in short, if a test fails – aliopi Feb 23 '17 at 13:09
  • 1
    @aliopi Not sure if you understood the answer and comment as it was not a test that causes the build to be marked as unstable here (if a test would have failed the build would probably not have succeeded but it did). – FrVaBe Feb 24 '17 at 08:20
  • 1
    "For example if the JUnit publisher is configured and a test fails then the build will be marked unstable." exactly why my build was unstable, thank you!!! – Michael Jan 08 '19 at 23:25
  • In my case, the previously failed report caused the unstable result so removing report folder solved it. – Mesut GUNES Feb 26 '19 at 06:17
  • typically the build log does not say explicitly what is reason of this UNSTABLE status, nor the involved publisher. Is there a debug log to check on jenkins ? – Donatello May 28 '21 at 14:18
  • 1
    Now Terminology is called Glossary https://www.jenkins.io/doc/book/glossary/ – Konstantin Ziubin Oct 22 '21 at 15:33
  • 1
    @KonstantinZyubin Thanks for the tip. I have adjusted the answer. – FrVaBe Oct 26 '21 at 06:02
0

If you have unit tests, make sure that they run when executing your build.

In my case, the unit tests are not run and Jenkins tagged the build as Unstable. When checking the console output, I found that 0 unit tests were running :

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

The fix for me is will not help resolve this topic but no harm to mention it:

I was Spring boot 2.2 and when I upgraded to v2.5, JUnit 5’s Vintage Engine was removed from spring-boot-starter-test, so I needed to add it to execute tests using JUnit 4.