32

I would like to use Pipeline to keep track of my Jenkin Jobs within my SCM. (Source control manager).

Is there a way I can take my existing jobs and export them to a valid Jenkinsfile which can be read by Pipeline?

The main plugins I'm using which I would need to be exported are Github Pull Request Builder, Test result reporters, code coverage reporters, as well as slack notification post-build tasks.

My main question is how to export my Jenkins settings into a Jenkinsfile as mentioned in the above link so that I don't have to write them all by hand.

Raghavendra
  • 1,419
  • 4
  • 19
  • 28
Bob
  • 1,605
  • 2
  • 18
  • 33

3 Answers3

21

Turns out the short answer is that you can't.

You need to look up each plugin you use and see if it has a syntax or support for Jenkinsfile and Pipelines.

Bob
  • 1,605
  • 2
  • 18
  • 33
11

You might give the Convert to Pipeline Plugin a try. It's primary purpose is to attempt to convert existing non-Pipeline Jenkins jobs into Pipeline jobs, complete with an option to generate a Jenkinsfile which is in turn committed to source control. As you correctly noted, there may still be several obstacles to a successful conversion (including support for Pipeline in various plugins).

Britt
  • 306
  • 2
  • 6
  • This plugin only allows freestyle jobs to be converted which may not be that much for a complex Jenkins system. – Jason Jul 23 '20 at 21:39
-9

http://thingsyoudidntknowaboutjenkins.tumblr.com/post/23596855946/git-plugin-part-3

Basically need to execute:

git checkout master before modifying any files

then

git commit -am "Updated version number" after modified files

and then use post build action of Git Publisher with an option of Merge Results which will push changes to github on successful build.

Ankit Gupta
  • 23
  • 1
  • 7
  • 1
    Thank you, but this isn't what I'm asking. I'll add links to my question to be more clear. – Bob Dec 19 '16 at 21:00