Is there a way to fail the build after it's finished?

42 views
Skip to first unread message

Maciej Jaros

unread,
Jan 13, 2016, 8:51:01 AM1/13/16
to Jenkins Users
Hi.

I want to fail one of the builds to be able to mark it as something that should not be deployed.

My setup is that I have two task:
  1. One just builds project and saves artifacts (war files).
  2. Second copies artifacts of last successful build and deploys them.
Occasionally some build passes automatic tests, but then fails after deployment. If I can mark the build as failed, then re-deployment would use older, but working version.

Regards,
Nux.

Eric Pyle

unread,
Jan 13, 2016, 9:19:21 AM1/13/16
to jenkins...@googlegroups.com
Seems like this could be handled by build promotion?
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/56965633.6030301%40mol.com.pl.
For more options, visit https://groups.google.com/d/optout.

Maciej Jaros

unread,
Jan 15, 2016, 7:54:07 AM1/15/16
to jenkins...@googlegroups.com
That doesn't work. There doesn't seem to be a simple way to promote all sucessfull build automatically (i.e. make them OK by default) and then revoke promotion status (effectively marking it is failed).

So still looking for a way to fail the build on demand (manually).

Eric Pyle (2016-01-13 15:16):

Victor Martinez

unread,
Jan 20, 2016, 8:33:28 AM1/20/16
to Jenkins Users, mac...@mol.com.pl
Probably you could run the build promotion and some adhoc system groovy script to change the status. But using that approach might be dangerous as you will use some internal api and will require some knowledge otherwise you might break its reliability and consistency.

What if you add an extra step like deploying the war file in a docker container/vagrant box and run some smoke tests and if it works then do your 2. task? 

Then your task pipeline woud be>
    1. One just builds project and saves artifacts (war files).
    1. Deploy war in an isolated container/box and do some test validations
    1. Second copies artifacts of last successful build and deploys them.
      Cheers
      Reply all
      Reply to author
      Forward
      0 new messages