Asynchronous Job type

Library plugin for custom job types that model external asynchronous processes

This is a library plugin, meaning it doesn't expose user-visible features by itself. Instead, it's meant to be used by other plugins as a dependency.

This plugin defines the AsyncJob/AsyncRun classes, which are abstract subtypes of Job and Run. These subtypes are convenient for modeling asynchronous executions that are happening outside Jenkins. Unlike AbstractBuild, where the duration of a build is tied to a life of an Executor thread, the completion of AsyncBuild is set by invoking a callback AsyncBuild.markCompleted(). Because of this, a AsyncBuild can stay in the "building" state across Jenkins restarts.

To make this extension possible, we bend Jenkins core a bit. As far as the core is concerned, AsyncBuild completes right away, but it fakes various state retrieval getter methods to make it look like it's still in progress. This will likely confuse some other plugins, but we hope to improve this faking as we go.

See TestAsyncJob and TestAsyncRun in the src/test/java for an example of how to use this plugin. To test it in action, run mvn -Dtest=Main test, wait for the line "Started SocketConnector@0.0.0.0:8888" to appear, and then open http://localhost:8888/

Changelog

Version 1.0 (Oct 26, 2012)

  • Initial release