gradle-jenkins-plugin
gradle-jenkins-plugin copied to clipboard
Spin up local Jenkins instance for testing
It'd be really awesome if this plugin offered some ease of Jenkins job testing (manual/integration/whathaveyou).
This plugin might have to add some tasks to:
- integrate with something like the Gradle Vagrant plugin or something with Docker
- install a set of Jenkins plugins on VM/container
- spin up instance of Jenkins from that VM/container
- update all views/jenkins jobs
It might help with integration (or acceptance) tests for this project too, which I noticed you're considering.
What do you think? Useful? Overkill?
Maybe a dependency to jenkins-war (http://maven-repository.com/artifact/org.jenkins-ci.main/jenkins-war/) and using a JavaExec or Exec task?
Then with a java -jar and classpath stuff to jenkins-war make your jenkins-test dependsOn and finalizedBy something that kills the process. For killing and starting processes this blog post can be an inspiration: http://fbflex.wordpress.com/2013/03/14/gradle-madness-execwait-a-task-that-waits-for-commandline-calls-to-be-ready/
The suggestion by @judoole is something I've been thinking about for a while. I was thinking about it in the context of a quick and dirty way to get a basic jenkins instance up and running from a source control repository. My discomfort has always been the overlap with traditional CM tools and whether there would be value/fit in having a gradle solution to the problem. Using it in the context of an integration test suite, though, that kind of creates a different value proposition.
Although some sort of container solution would be cool (and fun to implement), I feel like it's too technology specific. I'd prefer a general solution that would work on any platform and only relies on standard gradle mechanics.
I know Jenkins bundles Jetty, so as when you do a java -jar it runs embedded Jetty. Maybe there is a core class using org.eclipse.jetty.server.Server there which can be invoked? Then it could be fun to include that in a before-like step in the integrationtest of ones choice.
Or maybe a JenkinsRule is the best choice?
I realise this is an old thread now. For testing I like to use Docker these days. Their own version is super convenient:
https://registry.hub.docker.com/u/library/jenkins/