Resource Disposer

Introduction

resource disposer

Resource Disposer is a utility plugin for other plugins to depend on. Resources that are no longer needed (e.g., VMs to delete, entries in other systems, etc.) are registered with Resource Disposer, which repeatedly attempts to delete them. Resource disposal failures are reported in an administrative monitor and can be examined at ${JENKINS_URL}/administrativeMonitor/AsyncResourceDisposer/. Such entries are persisted between Jenkins restarts and tracked until either the plugin that has contributed them succeeds in disposing of them or they get removed some other way (e.g., the administrator removes them manually). If the problem preventing the disposal persists, administrators are expected to resolve the problem based on the administrative monitor reports.

For Developers

To integrate your plugin with Resource Disposer, follow these instructions.

Overview

Resource Disposer defines a single point of entry, AsyncResourceDisposer.get().dispose(), for consumers to have resources deleted asynchronously. Resource Disposer tracks the resources and attempts to dispose of them periodically until it succeeds. The registered resource is represented as a Disposable, a named wrapper that knows how the resource should be disposed of through Disposable#dispose(). The method is expected to either confirm the resource has been disposed of (by returning) or to provide the reason the resource could not be disposed of (for mere convenience, by throwing an exception that will be captured as the reason). The implementation is expected to identify the resource (and its kind/source) as well as the problem that occurred for the administrator to understand. Disposable implementations equal to each other will be collapsed under the assumption that they represent the same resource.

Manual intervention

Keep in mind that disposable resources might be disposed of by a human or some other automation. Therefore, the disposal algorithm must be implemented in such a way as to report successful disposal if the resource is manually disposed of.

Serialization

Disposables are persisted between Jenkins restarts, so they need to deserialize in such a way as to continue to be able to perform their task. If the resource is disposed of naturally by restarting Jenkins, the Disposable should deserialize into an object that report success all the time and will be unregistered on the first periodic disposal attempt.

Issues

Report issues and enhancements in the Jenkins issue tracker. Use the resource-disposer-plugin component in the JENKINS project.

Contributing

Refer to our contribution guidelines.

License

Licensed under the MIT License.