by Cpoll · 9y ago · 0 comments
Biggest lesson for us: Avoid putting all your logic into Jenkins templates. You're not capturing your CI/deployment logic in version control, and this can cause problems down the road (we backed up Jenkins regularly, but versioning was a weak point).
Instead, do as much as you can in scripts, and use Jenkins as a glorified crontab (+webhooks).
Jenkins Job Builder[1] is a great tool that solves exactly this problem. You write job definitions in yaml/json files. Then, check these yaml files into version control and run JJB to push these jobs to your Jenkins server.
JJB is great because it's purely a client. It requires no extra Jenkins plugins. Since all of your jobs are now captured in version control, you can reproduce your Jenkins jobs instantly in a local docker container or vagrant machine to dev/test change to your Jenkins jobs.
I really recommend trying it out. No more manually clicking around in Jenkins to configure things.
We've found the Job DSL plugin pretty useful for backing jobs up. https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin
Its also worth looking at replacing all your freestyle jobs with Jenkins Pipeline and have the job definition defined in a Jenkinsfile in your repository. We've got a new syntax coming out of beta shortly that makes the experience a lot more declarative thats worth a look https://github.com/jenkinsci/pipeline-model-definition-plugi...