jenkinsci / google-compute-engine-plugin

https://plugins.jenkins.io/google-compute-engine/
Apache License 2.0
57 stars 85 forks source link

Support stop GCE instance instead of Termination #35

Open rachely3n opened 5 years ago

rachely3n commented 5 years ago

As requested here

"Currently the google-compute-engine-plugin creates jenkins node and terminates them if idle. Instead of terminate, it's better to support stop the instance when idle."

craigdbarber commented 5 years ago

This issue will be resolved once we migrate to using managed instance groups: #78

rachely3n commented 5 years ago

Not sure this will be solved by instance groups. Feature requested is something EC2 has here: https://github.com/jenkinsci/ec2-plugin/blob/master/src/main/java/hudson/plugins/ec2/EC2RetentionStrategy.java

craigdbarber commented 5 years ago

Moving to InstanceGroups would allow us to remove the manual management of nodes and delegate that to the IGs. Happy to discuss further offline if you'd like.

AndreasKarg commented 4 years ago

Since #78 has been closed as "won't fix", is there any chance that support for GCE stop instead of termination might get picked up again? It would be super useful for my team & myself.

stevefortier commented 3 years ago

+1 for this to be reconsidered. It would avoid lots of lengthy rebuilds from scratch.

donmccasland commented 3 years ago

This is worth looking into. I've read through the instance groups discussion and agree that doing that work would require a tremendous amount of rewriting, but just stopping the instance and keeping it available for starting up again would be very nice.

akbertram commented 8 months ago

Plus one for this. We recently migrated away from this plugin to using a mess of shell scripts to achieve this behavior. The improvements in build time are significant.

Here is the solution I came up with: https://gist.github.com/akbertram/a1cf68983cf1f88d25c9e685f639761b

@craigdbarber I'd be happy to try to add this logic to the plugin if someone can point me in the right direction.

pezhovski commented 3 months ago

I agree, it would be a great feature to have. We are using builders to make builds on Unreal Engine, and it is tricky to configure all caches to persist after termination. But we also would like to have the ability to stop the instance when we are not using it (nighttime, weekends).

@akbertram Thank you for sharing your config to work around this limitation. If I were to start working on this task, I assume I would begin from here or here to handle instance termination/stop

And I think this class is responsible for provisioning, so I would start looking into this one if I wanted to start existing instances instead of launching new.

I also would think of one extra option: what part of instances I want to remain persistent. For example, I had high demand that happens once in a month and plugin provisioned 8 instances, but usually I need only 3, and now I don't have any builds queued should plugin stop all instances or just certain percent? I believe this should be configurable