-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins 2.204.2
EC2 Plugin 1.49.1
The latest version of the plugin added code to catch instances that were started, and then failed to connect to Jenkins. Previously such instances would stay up forever incurring unnecessary costs. The code block that adds this functionality is: https://github.com/jenkinsci/ec2-plugin/blob/master/src/main/java/hudson/plugins/ec2/EC2RetentionStrategy.java#L167-L185
Note hos whe termination branch is guarded by the clause `computer.isOffline()` which is unfortunately too broad. Looking up the definition of `computer.isOffline()` yields this code:
{{ @Exported public boolean isOffline() {}}
return temporarilyOffline || getChannel()==null;
}
This reveals that temporarilyOffline is considered too: as a result an instance that has sucessfully connected, but is, for example, under temporary maintenance will be abruptly terminated by the plugin.
AFAICT there is no simple workaround, besides perhaps rewriting `if (computer.isOffline()){` to `if (computer.getChannel()==null){`
I'll try to submit a patch asap