Hello, I want to create a modularized system for my jobs in order for them to be maintainable. I looked at all sorts of template plugins and generators, but it is either difficult(XML groovy script transformation?) or not really reuseable in my opinion. Now I stumbled upon the build flow plugin which made it possible! I wanted to share my approach because I could not find much about it on the net. Also I was hoping the list would give me some feedback. The setup is like this:
I have a number of "BuildStep-" prefixed jobs. I have these: => BuildStep-Checkout-Source - uses git to check out a branch => BuildStep-Compile - runs a shell script => BuildStep-Test - runs a shell script with tests Now all those buildsteps have in their "Advanced" setting the "Custom workspace" set to "$ParentWorkspace". Also the "Allow concurrent builds if needed" setting is checked. Then when I want to create a job which uses these jobs. I need to create a Build flow job now with the DSL script like this: build("BuildStep-Checkout-Source", ParentWorkspace:build.workspace, GitBranch: my_branch) build("BuildStep-Compile", ParentWorkspace:build.workspace) build("BuildStep-Test", ParentWorkspace:build.workspace) Now the nice thing is that your steps are loosely coupled. And that you can use the regular available configuration pages of the buildsteps, without the need for difficult scripting or XML. Also note that if you want something like default parameters for a buildstep, that you can specify the parameter in the buildstep explicitly and there you can use a default value. So now I just need to test if something like e-mails to the people who have broken the build will work ok :) Another pitfall: the Buildstep jobs are executed on random executors/nodes. So you need another trick until this is fixed in the build flow plugin. You need the https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin. Specify for each buildstep such a node parameter and name it e.g. "Node". Then you need to adapt the build() commands like this: build("BuildStep-Checkout-Source", ParentWorkspace:build.workspace, Node:build.environment["NODE_NAME"], GitBranch: my_branch) build("BuildStep-Compile", ParentWorkspace:build.workspace, Node:build.environment["NODE_NAME"]) build("BuildStep-Test", ParentWorkspace:build.workspace, Node:build.environment["NODE_NAME"]) So I think this is pretty good already, but what do you guys think? Thanks, Best regards, Tom, -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.