CyberKeeda In Social Media

How to export and import Jenkins job.

If you have multiple jenkins instances, there might be a requirement to export an existing jenkins job, that could be further imported into the newer jenkins instance.

We will learn how to do the export/import of jenkins job using jenkins cli.

How to Export existing Jenkins job.

  • Jenkins Home Page 
  • Manage Jenkins
  • Jenkins CLI.
  • Download  jenkins-cli.jar


  • Click on Jenkins CLI.




Once file "jenkins-cli.jar" file has been downloaded, we are ready to export our Jenkins job, lets do it.
Open your terminal and run the below commands.

Authenticate and List down your jobs to identify the one, which one you want to export, replace "your-jenkins-server-url:your_server_port" from your source jenkins server's url and port.

cyberkeeda@jenkins-master:~$ java -jar jenkins-cli.jar -s "http://your-jenkins-server-url:your_server_port" -auth UserName:Password  list-jobs

djpass-ansible
djpass-docker-app
docker ps

Now, from above enlisted jobs i want to export the one named as "djpass-docker-app".
Run the below command and replace the highlighted one by yours.

cyberkeeda@jenkins-master:~$  java -jar jenkins-cli.jar -s "http://your-jenkins-server-url:your_server_port" -auth UserName:Password get-job djpass-docker-app > djpass-docker-app.xml

We have successfully exported our jenkins job named as "djpass-docker-app" as an xml file named as "djpass-docker-app.xml"

How to import Jenkins job to different Jenkins server.

  • Go to your new jenkins server dashboard, where you want to import.
  • Follow the same above steps to download the jenkins-cli.jar file.
  • Ensure you are ready with "jenkins-cli.jar" and your exported jenkins job XML file with you.
Now run the below command to import your jenkins job xml file to new jenkins server.
Note : Replace the highlighted one by yours.

Preview:
cyberkeeda@jenkins-slave:~$  java -jar jenkins-cli.jar -s "http://your-Newjenkins-server-url:your_server_port" -auth UserName:Password create-job new-djpass-docker-app < djpass-docker-app.xml

Hoah !!! Thats it, check your dashboard to verify the same.

17 comments:

  1. Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles Python course

    ReplyDelete
  2. Ask relatives and friends about jobs where they work. Ask every relative and friend you have now or have ever had about vacancies they may know about where they work, or where anyone else works.Hr recruitment Companies in India

    ReplyDelete
  3. Titles should be industry-specific and familiar to job seekers since they will use keyword search for positions according to standard job titles. The Job Title field is not the field to market the job posting (like with a classified ad).How to Make cover letter

    ReplyDelete
  4. Every job contributes to that career in some manner, even if the job offers nothing new or challenging and confirms that a person is ready to find new employment or a new occupation. ashamed of being unemployed

    ReplyDelete
  5. I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. Europa-Road targonca szállítás Debrecen

    ReplyDelete
  6. It's rare all around educated individuals in this specific point, yet you sound like you hear what you're saying! Much obliged
    earthcycle

    ReplyDelete
  7. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. vape attic olathe

    ReplyDelete
  8. Very nice article. I enjoyed reading your post. very nice share. I want to twit this to my followers. Thanks !. good morning messages for him

    ReplyDelete
  9. Thanks for sharing this article. I think You put a great deal of exertion to make this article. I like your work. Unique Dofollow Backlinks

    ReplyDelete
  10. Pretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts. After all I’ll be subscribing to your feed and I hope you write again soon! Shipping Container

    ReplyDelete
  11. Writing in all Caps, utilizing unnecessary interjection focuses, or adding abbreviations and contractions will decrease the believability of the job posting and possibly bring about job cancellation by the facilitating job board. https://europa-road.eu/hu/foldmunkagep-szallitas-debrecen.php

    ReplyDelete
  12. Second hand gold buyers in Bangalore

    Maximum Cash
    We are the only company
    of our kind to offer you up to ₹10,000 extra on selling your gold and other precious metals.
    Door-Step Services
    Second Hand Gold Buyers in Bangalore provide door-step services if you’re unable to visit our office. Contact us today to book an appointment.
    Business Consultation
    We offer business consultation for all types of industries. Old Gold Buyers in Bangalore help you to become more efficient in your sector.
    Franchise Opportunity
    We guarantee a return of 38% to 45% annually on becoming our franchisee.

    https://prismleadindia.com/gold-buyers-in-bangalore/

    ReplyDelete
  13. prism lead India is best business listing company for CA service, Modular Kitchen Design, Painting, Packers and movers, Event Organizer.interior designing, we provide good services.
    prism lead India is best business listing company for CA service, Modular Kitchen Design, Painting, Packers and movers, Event Organizer,interior designing. we provide good services
    packers-and-movers-Hyderabad
    packers-and-movers-mumbai
    packers-and-movers-Bangalore
    interior designing in bangalore.

    Commercial Interior Designer Bangalore https://prismleadindia.com/commercial-interior-designer-bangalore/
    Interior designers in Bangalore https://prismleadindia.com/interior-designers-in-bangalore/
    Interior Designers in Channahalli https://prismleadindia.com/interior-designers-in-channahalli/

    ReplyDelete
  14. your article is good thank you.
    prism lead india is best business listing company for CA service, Modular Kitchen Design, Painting, Packers and movers, Event Organizer. we provide good services

    Commercial Interior Designer Bangalore
    Interior designers in Bangalore
    tv repair service near me
    refrigerator repairing near me/

    ReplyDelete

Designed By Jackuna