jenkinsci / groovy-events-listener-plugin

A Jenkins plugin, which executes groovy code when an event occurs.
https://plugins.jenkins.io/groovy-events-listener-plugin/
MIT License
36 stars 34 forks source link

Add scheduler #14

Closed Jimilian closed 8 years ago

Jimilian commented 8 years ago

Now it's possible to setup plugin to execute script every minute (or less frequently). It's quite useful if you want to push queue size, executors load or something like that from Jenkins.

jenkinsadmin commented 8 years ago

Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests.

Jimilian commented 8 years ago

@nickgrealy, is it ok for you?

nickgrealy commented 8 years ago

Yep. Had a look last night, looks simple and clean. Nice!

Want me to merge and publish a new version?

Jimilian commented 8 years ago

Yes, it would be great!

Jimilian commented 8 years ago

Tomorrow I'm going to add new feature -> add paths for classloader. It will make possible importing groovy classes from disk. Right now we are using workaround:

this.getClass().getClassLoader().addClasspath('/var/lib/jenkins/groovy_scripts/');
this.getClass().getClassLoader().loadClass("com.companyname.ClassName");
def coolStats = new com.companyname.ClassName(run); // This line starts to work only after success execution of previous one

But it's not very user-friendly. So, I decided to add one extra field for advanced users -> classPaths and force plugin to load this classes to plugin.