Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a default configuration for each (new) Jenkins job?

During my long use of Jenkins I have come up with a set of defaults which I use for each new job, such as:

  • using Workspace Cleanup Plugin to clean workspace before each build,
  • adding timestamps to the Console Output,
  • using the same SCM viewer

etc.

..but for now I set them up manually/copy an existing job as a template for a new one but that is obviously non-optimal.


I have looked for a plugin/setting that would enable me to configure the default setting for new jobs/global job settings that would override each job settings but I haven't found any solution yet.

Do you know how to do it?

Update

I have looked at Configuration Slicing Plugin but it's not clear to me whether this will help..

Update 2

I have just been reminded of Jenkins Job DSL / Plugin and I will look into its features soon but I am still interested in a simpler solution, with a lower entry level.

like image 313
Greg Dubicki Avatar asked Oct 31 '22 21:10

Greg Dubicki


1 Answers

You could try the Job DSL which does the Dev Ops 'configuration as code' by building out your jobs (using another job)

The Jenkins "Job DSL / Plugin" is made up of two parts: The Domain
Specific Language (DSL) itself that allows users to describe jobs 
using a Groovy-based language, and a Jenkins plugin which manages 
the scripts and the updating of the Jenkins jobs which are created 
and maintained as a result.

Alternatively, the new way to do it is to define a pipeline (Jenkins 2.0) Which is a Jenkinsfile in the root of your repo

Jenkins Pipeline is a suite of plugins which supports implementing 
and integrating continuous delivery pipelines into Jenkins. Pipeline
provides an extensible set of tools for modelling simple-to-complex
delivery pipelines "as code" via the Pipeline DSL. 
like image 171
KeepCalmAndCarryOn Avatar answered Nov 15 '22 07:11

KeepCalmAndCarryOn