Frage

we have jenkins project. use case:

  • jenkins triggers the build
  • slave agent builds application
  • server with slave agent goes to reboot (for any reason, for example, problem with electricity, somebody rebooted it, resource shortage and so on)

after that jenkins reports about failed build. how can we automatically relaunch application building in jenkins when slave agent recovered from failure?

War es hilfreich?

Lösung

There are two aspects to this issue -

  1. Jenkins Server needs to reschedule the build that failed
    (when the slave-machine crashed).
    • Install the Naginator Plugin
    • Set it to rebuild whatever job you have set on the problematic slave

  2. Jenkins Slave needs to restart automatically as soon as its host is up again.
    • On Windows, for example, you need to set it with a service that starts automatically

Note the Naginator Plugin doesn't know what caused the build to fail,
so it will try to rebuild any build that fails.
To solve this, scan the log for an indication that the slave crashed
and set a regular expression (in the Naginator) to catch it.

Cheers

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top