-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
ec2: 1.42
Seeing EC2 agent on Linux that will stay connected for a good while and than suddenly get stuck on Connection terminated and never get cleaned up.
This prevents new agents from being provisioned.
I wrote this piece of groovy script to remove orphaned disconnected agents.
Would this PR solve this issue?
import jenkins.model.Jenkins import hudson.plugins.ec2.EC2AbstractSlave println "Cleaning up offline EC2 slaves..." Jenkins.instance.slaves.each { node -> if(!(node in EC2AbstractSlave)) return def computer = node.getComputer() if (computer && !computer.isOffline()) return def logs = computer.getLog() if (!logs) return if (!"Connection terminated".equals(logs.readLines().last())) return println "Deleting ${node.name}" computer.doDoDelete() } null