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”

Trigger Jenkins Job using AWS Lambda triggered by S3 Event

The problem that we faced:

There was a cron scheduled in our environment at a particular time which used to run at 8AM. This cron read data from the s3 bucket and used to succeed but failed when there were no objects present.

Problem this Integration solves:

  • Eliminates the need of keeping a scheduler in the system. Lambda will work as a Scheduler.
  • No manual intervention will be required in case the file from one service is delayed by a minute or an hour due to any reason. 
  • Data exchange and processing between teams become more efficient and less error-prone.
  • Eliminates the need of checking the presence of files on S3. It all gets automated.

Workflow:

  1. The object is uploaded to S3
  2. S3 event triggers a Lambda function
  3. Lambda starts Jenkins job using Jenkins API
Continue reading “Trigger Jenkins Job using AWS Lambda triggered by S3 Event”

Active-Active Infrastructure using Terraform and Jenkins on Microsoft Azure

In this blog, we will create an active-active infrastructure on Microsoft Azure using Terraform and Jenkins.

Prime Reasons to have an active-active set-up of your infrastructure

Disaster Recovery:

Disaster recovery (DR) is an organization’s method of regaining access and functionality to its IT infrastructure after events like a natural disaster, cyber attack, or even business disruptions just like during the COVID-19 pandemic.

  • Ensure business resilience
    No matter what happens, a good DR plan can ensure that the business can return to full operations rapidly, without losing data or transactions.
  • Maintain competitiveness
    Loyalty is rare and when a business goes offline, customers turn to competitors to get the goods or services they require. A DR plan prevents this.
  • Avoid data loss
    The longer a business’s systems are down, the greater the risk that data will be lost. A robust DR plan minimizes this risk.
  • Maintain reputation
    A business that has trouble resuming operations after an outage can suffer brand damage. For that reason, a solid DR plan is critical.
Continue reading “Active-Active Infrastructure using Terraform and Jenkins on Microsoft Azure”

ECS rollback with Jenkins Active Choice Parameter

Browser: Chrome or Firefox or Brave? (Sorry Edge! :p )

Social Media: Facebook or Instagram?

In our daily lives, we always have choices, which one to use.

That was a brief intro about what we are going to read today. Yes, choices!

In Jenkins, while defining parameters, we can mention whether it needs to be a string parameter, a choice parameter, etc. These parameters will work on the input that you are mentioning in your job while running it. For example, if you are asking the user to choose between options A or B, the user chooses the parameter, and then Jenkins runs the script with that parameter.

Continue reading “ECS rollback with Jenkins Active Choice Parameter”

Using TruffleHog Utility in Your Jenkins Pipeline

Introduction

This is a quick blog on how we can use the TruffleHog utility in our Jenkins pipeline to search for the secrets, passwords, sensitive keys which may have been accidentally committed in our repositories.

TruffleHog proves to be a great tool in helping us to fetch the sensitive data from our repositories which we do not want to expose at any cost.

Before moving further with this blog, I would like you all to take a look at the prerequisites that are mentioned below.

Continue reading “Using TruffleHog Utility in Your Jenkins Pipeline”