jenkinsci / jenkinsci/openstack-cloud-plugin

Clean up old VM instances after a jenkins restart

Open
#391 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
49
Forks
97
Avg merge
13h 23m
Merged PRs (30d)
6

Description

### What feature do you want to see added?

**Context**
We have an Openstack VM configured in jenkins casc.yaml to have a minimum instance number of 1.

**Problem**
After we restart Jenkins (i.e., rollout the Jenkins pod or kill and start the container), the plugin launches a new VM instance and leave the old one running in the cloud. This is making things difficult to manage given that we end up with multiple long running VMs which are never used.

**Request**
Would it be possible either:
1. clean up the old VMs after jenkins is restarted - maybe the plugin could filter the VMs present in the cloud using the VM labels (e.g., JENKINS_URL or something else)
2. capture the jenkins restart/stop and send a termination signal to the VMs - although, even if doable, it may not work with containerized jenkins
3. maybe some other options i'm not thinking about

**Additional Info**
- reloading configuration via Jenkins UI doesn't seem to be reproducing the same behavior
- retentionTime is not set in our current configuration, due to malfunctioning faced in v2.65 (i.e., instance not being terminated https://github.com/jenkinsci/openstack-cloud-plugin/issues/384). However I guess it wouldn't change this situation right?

### Upstream changes

_No response_

### Are you interested in contributing this feature?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.