问题
On a project Im working on we have a pretty advanced command-line interface to build, test, package and deploy software.
Now we want to use jenkins as a front-end to this CLI and we want to be able to generate job configurations. We want the interface simple, the user only supply a couple of parameters and jenkins will then query our CLI and generate the needed build steps.
Simple use case:
- Create new domain-specific-job
- Select Product
- Jenkins now queries the CLI and updates the next drop-down with the products different brances.
- Select branch
- Jenkins generates the build steps by querying the build steps
As Im new to plugin development in Jenkins (and jenkins overall) I would love to get some tips and pointers to where to start.
回答1:
There are several plugins to generate jobs in Jenkins, there is also the Jenkins CLI.
I think the better approach would be to use the Jenkins CLI to generate Jobs from the outside by developing a cool GUI tool integrating both CLIs nicely. Here is an example: http://tikalk.com/alm/using-jenkins-cli-job-gen
If you really require to do it in the Jenkins front-end then here are some pointers on possible plugins:
- job DSL plugin https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin
- jobcopy builder plugin https://wiki.jenkins-ci.org/display/JENKINS/Jobcopy+Builder+plugin
- job generator plugin https://wiki.jenkins-ci.org/display/JENKINS/Job+Generator+Plugin
回答2:
Take a look at jenkins-job-builder from jenkins, it could help you to abstract your work and use command line to create the jenkins jobs.
来源:https://stackoverflow.com/questions/18895169/jenkins-job-generator