Jenkins Job Creation using Multibranch Job DSL

Introduction

In this blog, we will explore the world of Jenkins job DSL and learn how to leverage its capabilities to streamline and automate job configuration management. We will walk through the process of setting up the Job DSL environment, writing Job DSL scripts to define different types of jobs, managing job configurations as code, and integrating Job DSL with your CI/CD pipelines.

Prerequisites

Before getting started, ensure that you have the following prerequisites in place:

  • Jenkins is installed and running.
  • Job DSL plugin is installed and configured in Jenkins.

What is Job DSL?

Job DSL is a powerful plugin that allows you to define Jenkins jobs as code, bringing the benefits of version control, automation, and scalability to job configuration management. With Job DSL, you can write Groovy scripts to define Jenkins job configurations programmatically. 

DSL stands for Domain Specific Language.

Some of the important methods in Job DSL are

a. folder: You can create a folder using the folder DSL method. Folders provide a way to organize your jobs and create a hierarchical structure in Jenkins. Here’s an example of how to create a folder using the Job DSL:

folder('Microservice') {
    displayName('Microservice')
    description('Folder for Microservice')
}
Continue reading “Jenkins Job Creation using Multibranch Job DSL”

Basic Logging Setup of Loki Grafana

Let’s say you are the DevOps lead for a large e-commerce platform that runs on a microservices architecture with hundreds of services. You need to monitor the logs of all these services to quickly identify issues, troubleshoot problems, and optimize the system’s performance. You also want to be able to search and analyze logs across all services in real time and be alerted when any critical issues arise.

To address this scenario, you could use Grafana Loki as your centralized logging system. Loki is a lightweight and cost-effective solution that can handle high volumes of logs and store them in a distributed manner. You can configure each service to send logs to Loki, which will automatically index them and make them available for search and analysis.

Introduction

Loki and Grafana are two open-source projects that are commonly used together for log aggregation, analysis, and visualization.

Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus. It is designed to be a cost-effective solution for storing and querying logs and uses a unique indexing approach to provide fast and efficient searching of log data. Loki is also highly extensible, allowing users to easily add custom logging drivers and integrate with other systems.

Grafana, on the other hand, is a popular open-source platform for visualizing and analyzing time-series data, including logs. It provides a powerful and flexible dashboarding system that allows users to create customized visualizations and alerts based on their log data. Grafana also integrates with many different data sources, including Loki, which makes it a great choice for log analysis and visualization.

Continue reading “Basic Logging Setup of Loki Grafana”

Cloud Cost Estimation with Infracost

Introduction

Estimating costs can be a nightmare for many enterprises. Cloud cost estimation is important for organizations to plan their budget and forecast expenses accurately. It is essential to monitor and analyze cloud usage regularly to optimize cloud spending and avoid unexpected expenses.

This process is very time-consuming, so there was a need for change. With Terraform, you can easily estimate cloud costs by leveraging Infracost, and you can easily compare potential bills between different vendors.

Working with cloud providers and DevOps is all about speed, efficiency, and cost management.

Infracost is a tool that is used to figure out how much the cloud resources will cost.

What is Infracost?

Infracost is a super cool tool that lets you calculate the cost of your Terraform resources on AWS, GCP, or Microsoft Azure before you even hit deploy. This enables you to see cloud cost estimates for Terraform in pull requests.

Continue reading “Cloud Cost Estimation with Infracost”

Azure CDN

How it works?

Azure Content Delivery Network (CDN) is a CDN service provided by Azure Cloud Platform that enables storing and accessing data on different content servers and locations – used by online or cloud services.  A CDN store the content cached on the edge servers that are available in the POP locations to reduce latency. Azure CDN is important for us which requires multiple hits to boost up the process of our applications.

Benefits of using Azure CDN –

  • Better performance and improved user experience for end users
  • Large scaling to better handle instant high loads
  • Distribution of user requests and serving of content directly from edge servers so that less traffic gets sent to the origin server.
Continue reading “Azure CDN”

How to Setup SSO in Jenkins?

Introduction

Providing OAuth 2.0 user authentication directly or using Google+ Sign-in helps us to achieve a modern authentication method. It also provides a trusted and secure login system that’s familiar to users, consistent across devices, and removes the burden of users having to remember another username and password. One of the hurdles in implementing a Gmail authentication is that the Google developer console and your  Jenkins server should be in the same network or in simple terms they can talk to each other.

What is SSO ?

SSO stands for Single Sign-On, which is a method of authentication that allows users to access multiple applications and services with a single set of login credentials.

With SSO, users are only required to enter their login credentials once, and they can then access all the applications and services that are part of the SSO system. This simplifies the authentication process, improves user experience, and reduces the risk of security breaches.

Continue reading “How to Setup SSO in Jenkins?”