1

I have 15 Jenkins jobs configured in order to implement a specific flow. I am improving and editing these jobs as time goes by.

Is there a way to save all these jobs and its configurations to a repository or at least in the form of export jobs, save it and import when needed?

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Anuj Balan
  • 7,629
  • 23
  • 58
  • 92
  • Possible duplicat of http://stackoverflow.com/questions/2087142/is-there-a-way-to-keep-hudson-jenkins-configuration-files-in-source-control – Vitalii Elenhaupt Jul 28 '15 at 18:56

4 Answers4

3

There are two plugins that will help you save Jenkins jobs, "SCM Sync configuration" and "JobConfigHistory" defined at the wiki.jenkins-ci.org website.

SCM Sync Configuration Plugin (which keeps the config in a SCM repository)

or

Job Config History Plugin (Saves copies of all job and system configurations)

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Larry Shatzer
  • 3,579
  • 8
  • 29
  • 36
2

The Job DSL Plugin allows to define the jobs in a DSL and store the DSL scripts in a SCM repo. The DSL increases the readability of the config files in contrast to the XML format.

For an intro, see the slides and video from the Configuration as Code: The Job DSL Plugin talk at the Jenkins User Conference 2015 in London.

daspilker
  • 8,154
  • 1
  • 35
  • 49
0

You can move/copy jobs to another destination simply by copying directory with job (default path for jobs directories is /var/lib/jenkins/jobs).

You can get more info here - https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins

Ondřej Šotek
  • 1,793
  • 1
  • 15
  • 24
  • Ya I have seen it but I feel it isn't the efficient way of archiving/saving. Is there any other way to link with a repo? – Anuj Balan Jul 28 '15 at 18:06
0

The Workflow feature may let you write your entire process as one (Groovy) script, which you can then maintain in your version control system alongside other sources.

Jesse Glick
  • 24,539
  • 10
  • 90
  • 112