continuous integration - Best way to configure jenkins job running on different slaves -
i want run jenkins job on 4 different slaves (windows, linux, solaris, mac). instead of making 4 different jobs want have single job. can use node parameter execute on different slaves. job runs script uses jenkins workspace of slave , few other scripts. script in different folder on each slave, , other required scripts in different folder. have created 4 different jobs each slave , hard-coded jenkins workspace , other required scripts path.
is there way can put paths in json-like structure , depending on slave pick paths? have 1 job only.
please suggest, in advance!
my idea use e.g "execute system groovy script" slave value , use if statement assigne proper path , create parameter visible in environment variables:
import hudson.model.computer import hudson.model.stringparametervalue import hudson.model.parametersaction //get slave name def slavename = computer.currentcomputer().getnode().name def path //choose path if(slavename.equals("slave01")){ path = "c:" } if(slavename.equals("slave02")){ path = "/root" } if(slavename.equals("slave03")){ path = "d:" } //pass path env. variable build.addaction(new parametersaction(new stringparametervalue('path', path)))
then can use variable path in command: echo %path%
or use conditional buildstep plugin set separable steps each operation system , control when each step should executed
Comments
Post a Comment