After almost a year of slow but steady development, the time is soon approaching when you will be able to start writing Jenkins plugins armed with nothing but a simple JRuby environment.
To illustrate exactly what this means, we'll study the anatomy of a Ruby plugin, how it works at runtime, and walk through the creation, testing and deploying of an example using nothing put 100% pure Ruby.
Finally, beyond the mechanical, we'll discuss why this effort is important for the entire Jenkins community, not just the part of the community that uses Ruby.
37. Plugin.java
Jenkins
•
Ruby Runtime Plugin
Small as can
jenkins-ruby-api possibly be
Ruby Plugin A bundled gems
•
plugin ruby code
5 small classes
Ruby Plugin B .....
• will not instantiate
extension points
jenkins-ruby-api
Ruby Plugin C bundled gems
plugin ruby code
38. Plugin.java
Jenkins
•
Ruby Runtime Plugin
every plugin gets
its own scripting
JRuby
Ruby Plugin A
container
Ruby Plugin B .....
• isolation +
JRuby backwards
Ruby Plugin C
compatibility
40. Plugin.rb
Jenkins
•
Ruby Runtime Plugin
own copy of API
JRuby
ruby API
Ruby Plugin A bundled gems
extension points • own copy of gems
Ruby Plugin B .....
• Ruby extension
JRuby points detected
Ruby Plugin C
ruby API
bundled gems
and auto-loaded
extension points
41. Plugin.rb
Jenkins
Ruby Runtime Plugin
JRuby
• Library code is
free to vary from
ruby API 1.1
Ruby Plugin A json 1.5, nokogiri 1.8
extension points
plugin to plugin
•
Ruby Plugin B .....
This includes the
plugin API!
JRuby
ruby API 1.3rc5
Ruby Plugin C json 1.6.4
extension points
42. Plugin.rb (API)
• Builder - implement build steps
• Publisher - run build steps after build
complete
• BuildWrapper - decorate a build with
setup/teardown
43. Plugin.rb (API)
• All Ruby extension points are Plain old
Ruby objects (TM)
• Plugin maintains two-way list of proxies to
support this