DevOps.com

Where the world meets DevOps

  • Home
  • Features
  • Neighborhoods
    • Cloud
    • Continuous Delivery
    • Continuous Testing
    • DevSecOps
    • Leadership Suite
    • Practices
    • ROELBOB
    • Toolbox
  • Webinars
    • Upcoming
    • On-Demand
  • Library
  • Chat
  • News
  • Authors
  • Directory
  • About
  • Related Sites
    • Container Journal
    • DevOps Connect
    • DevOps Dozen
    • DevOps Institute
    • Microservices Journal
    • Security Boulevard

Home » Blogs » DevOps Practice » Using Jenkins Configuration as Code

Using Jenkins Configuration as Code

Using Jenkins Configuration as Code

Santosh Rahul GoruBy Santosh Rahul Goru on April 4, 2019 Leave a Comment

Using the following code, we can configure Jenkins Master to integrate Sonar, Nexus and Jira and manage them as a code. Code as configuration is a plugin in Jenkins, which is very popular and simple to use.

 
Related Posts
  • Kubernetes Jenkins Master-Slave: Scaling the Scalability Issue
  • Webinar: Evolving the Jenkins UI
  • ElasticBox Jenkins Plugin – Easy Continuous Integration Setup
    Related Categories
  • Blogs
  • Continuous Delivery
  • DevOps Practice
  • DevOps Toolbox
    Related Topics
  • JCasC
  • Jenkins configuration
  • Jenkins master
  • jenkins plugin
  • yaml
Show more
Show less
 

First, we need to install plugins from Jenkins Market place.

 

Manage Jenkins > Manage Plugins > Advance

 

 

After installing, got to Manage Jenkins and you will find Configuration as Code settings.

 

 

After opening this link, it will give us the Jenkins Configuration as Code screen.

 

Here, you have two steps:

 
     
  1. URL or Path.
  2.  
  3. Export the Existing configuration.
  4.  
 

Provide URL or Path

 

We have two options for storing Jenkins.yaml file:

 
     
  1. Any directory Jenkins is running
  2.  
  3. Version Control (such as Git)
  4.  
 

If we go with option one, then we need to place Jenkins.yaml file in JENKINS_HOME directory, place that directory path and click on “Apply new configuration.”

 

 

If we go for version controlling, we need a place for the Jenkins.yaml file and then we need to open the file in a raw format in GitLab, as shown below:

 

 

Now, place that link and click on Apply new Configuration.

 

 

Export the Existing Configuration

 

Export the current configuration into Jenkins.yaml, click the Export Configuration button to download the Jenkins.yaml file.

 

 

After opening this file, you may see some errors. Keep in mind, this is still in under development so the export function is now working properly.

 

 

We can write Jenkins.yaml file in simple YAML format.

 

Plugins

 

This is what the YAML format looks like:

 

 

Let’s move to next step tool’s installation.

 

Tool installations

 

This is what it would look like during the tool installation:

 

 

Tools Integration

 

 

The next step is the pipeline job configuration.

 

Setting Up Job with JCasC

 

 

Now, let’s bring everything together and see what happens in Jenkins:

 

 

After applying the new configuration, it will show the date, time and path of the configuration.

 

 

If there is an error in syntax format, it will throw the error as shown below:

 

 

Rest API Method to Submit the Configuration

 

Here, officially we have JCasC. There is a way to apply changes through CURL.

 

Here we have two CURL commands:

 
     
  1. Validation
  2.  
  3. Applying the new
  4.  
 

Validation

 

Here, I am using Jenkins YAML to store in version controlling tool with public repo:

 

 

Response will be as shown below:

 

 

Applying new Configuration

 

  
Sponsored Content
Featured eBook
Ten Layers of Container Security

Ten Layers of Container Security

Containers make it easy to ensure consistency across environments and multiple deployment targets like physical servers, virtual machines, and private or public clouds. But enterprises require strong security. This book describes 10 key elements of security for different layers of the container solution stack and different stages of the container ... Read More
 

Filed Under: Blogs, Continuous Delivery, DevOps Practice, DevOps Toolbox Tagged With: JCasC, Jenkins configuration, Jenkins master, jenkins plugin, yaml

  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • More
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
« Using Product Experimentation for Continuous Improvement
Sectigo Adds ACME Protocol Support in Certificate Manager Platform to Automate SSL Lifecycle Management »
Continuous delivery is a software engineering discipline that allows organizations to consistently develop and release quality software at a rapid pace. It is achieved by automating the software development lifecycle, enabling tasks such as development, testing and release to occur concurrently and continuously.

Newsletter Sign-up

  • View DevOps.com Privacy Policy
DevSecOpsDays_300x250DevSecOpsDays_300x250

This Week at MediaOps

Upcoming Webinars

Wed 10

How to Achieve SOC 2 in a Containerized Environment

Wed, April 10, 11:00 am - 12:00 pm EDT
Wed 10

Using AI-powered Automation for High Performance Data Pipelines in the Cloud

Wed, April 10, 1:00 pm - 2:00 pm EDT
Thu 11

Mainframe DevOps Using Zowe Open Source

Thu, April 11, 11:00 am - 12:00 pm EDT

More Webinars

Past Webinars

Past Webinars

DevOps.com Webinar ReplaysDevOps.com Webinar Replays

Download Free eBook

Hybrid Cloud Strategy for Dummies
Hybrid Cloud Strategy for Dummies

RSS DevOps Chat

  • Chef Re-Affirms Its Open Source Model
  • Sqreen Raises $14m For Application Security Management
  • Performance Load Testing w/ SmarBear's Keshav Vasudevan
  • New Challenges in Email Security w/ Asaf Cidon of Barracuda
  • White Source for Containers w/ David Habusha

RSS Security Boulevard

  • Stalkerware? Spouseware? Creepware? Just Call It Horrific
  • Intel Advances Hardware-Centric Approach to Cybersecurity
  • Meeting the Challenges of Securing a Cloud-Native World
  • Aruba Advances IoT Cybersecurity
  • 5 Mobile Security Threats to Recognize

RSS Container Journal

  • Explaining Kubernetes’ Popularity: It’s the Community, Not the Technology
  • SUSE Melds Kubernetes and Cloud Foundry Further
  • The Differences Between Linux and Windows Containers
  • MapR Embraces Kubernetes for Big Data
  • Preparing for a Move to Microservices
  • Home
  • Business Directory
  • About DevOps.com
  • Write for DevOps.com
  • Media Kit
  • Sponsor Info
  • Copyright
  • TOS
  • Privacy Policy

© 2019 ·MediaOps Inc.All rights reserved.

    • Twitter
    • LinkedIn
    • Facebook
    • YouTube
    • RSS Feed
  • Home
  • Features
  • Neighborhoods
    • Cloud
    • Continuous Delivery
    • Continuous Testing
    • DevSecOps
    • Leadership Suite
    • Practices
    • ROELBOB
    • Toolbox
  • Webinars
    • Upcoming
    • On-Demand
  • Library
  • Chat
  • News
  • Authors
  • Directory
  • About
  • Related Sites
    • Container Journal
    • DevOps Connect
    • DevOps Dozen
    • DevOps Institute
    • Microservices Journal
    • Security Boulevard
  • Home
  • Business Directory
  • About DevOps.com
  • Write for DevOps.com
  • Media Kit
  • Sponsor Info
  • Copyright
  • TOS
  • Privacy Policy

Our website uses cookies. By continuing to browse the website you are agreeing to our use of cookies. For more information on how we use cookies and how you can disable them, please read our Privacy Policy.