зеркало из https://github.com/dotnet/dotnet-ci.git
Remove Helix agents in node cleanup script (#970)
Sometimes Jenkins takes agents offline for no apparent reasnon. We remove these agents periodically. Add Helix agents to the list of agents to remove
This commit is contained in:
Родитель
bbdec17e08
Коммит
45220c20f7
|
@ -2,15 +2,17 @@
|
||||||
|
|
||||||
import jenkins.model.Jenkins
|
import jenkins.model.Jenkins
|
||||||
import com.microsoft.azure.vmagent.AzureVMAgent
|
import com.microsoft.azure.vmagent.AzureVMAgent
|
||||||
|
import com.microsoft.helix.helixagents.HelixAgent
|
||||||
|
|
||||||
def nodes = Jenkins.instance.getNodes()
|
def nodes = Jenkins.instance.getNodes()
|
||||||
|
|
||||||
nodes.each { node ->
|
nodes.each { node ->
|
||||||
if (node instanceof AzureVMAgent) {
|
if (node instanceof AzureVMAgent || node instanceof HelixAgent) {
|
||||||
if (node.getComputer() != null) {
|
if (node.getComputer() != null) {
|
||||||
if (node.getComputer().isTemporarilyOffline()) {
|
if (node.getComputer().isTemporarilyOffline()) {
|
||||||
def cause = node.getComputer().getOfflineCause()
|
def cause = node.getComputer().getOfflineCause()
|
||||||
if (!(cause instanceof hudson.slaves.OfflineCause.UserCause)) {
|
if (!(cause instanceof hudson.slaves.OfflineCause.UserCause) &&
|
||||||
|
(!(node instanceof HelixAgent) || !(cause instanceof hudson.slaves.OfflineCause.SimpleOfflineCause))) {
|
||||||
println "Removing " + node.getComputer().getName() + " "
|
println "Removing " + node.getComputer().getName() + " "
|
||||||
Jenkins.instance.removeNode(node)
|
Jenkins.instance.removeNode(node)
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,9 +448,9 @@ job('node_cleaner') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run hourly
|
// Run every hour
|
||||||
triggers {
|
triggers {
|
||||||
cron('@daily')
|
cron('@hourly')
|
||||||
}
|
}
|
||||||
|
|
||||||
// We stream from the workspace since in the groovy 2.0 plugin, the scripts
|
// We stream from the workspace since in the groovy 2.0 plugin, the scripts
|
||||||
|
|
Загрузка…
Ссылка в новой задаче