Skip to main content

Jenkins - DevOps

What is Jenkins?

Jenkins is an easy-to-use open-source java-based CI/CD tool. Jenkins has huge community support and an ocean of plugins that can integrate with many open-source and enterprise tools to make your life so easy.

The following diagram shows the overall architecture of Jenkins and the connectivity workflow.

Following are the key components in Jenkins

  1. Jenkins Master Node
  2. Jenkins Agent Nodes/Clouds
  3. Jenkins Web Interface

Jenkins Server (Formerly Master)

Jenkins’s server or master node holds all key configurations. Jenkins master server is like a control server that orchestrates all the workflow defined in the pipelines. For example, scheduling a job, monitoring the jobs, etc.


Let’s have a look at the key Jenkins master components.

Jenkins Jobs

A job is a collection of steps that you can use to build your source code, test your code, run a shell script, run an Ansible role in a remote host or execute a terraform play, etc. We normally call it a Jenkins pipeline.

Jenkins JOB: Clone from GitHub > Compile Code > Run Unit test cases.

If you translate the above steps to a Jenkins pipeline job, it looks like the following.

Jenkins Plugins

Plugins are official and community-developed modules that you can install on your Jenkins server. It helps you with more functionalities that are not natively available in Jenkins.

For example, if you want to upload a file to s3 bucket from Jenkins, you can install an AWS Jenkins plugin and use the abstracted plugin functionalities to upload the file rather than writing your own logic in AWS CLI. The plugin takes care of error and exception handling.

Here is an example, of s3 file upload functionality provided by the AWS Steps plugin


You can install/upgrade all the available plugins from the Jenkins dashbaord itselft. For corporate network, you will have to setup a proxy details to connect to the plugin repository.

You can also download the plugin file and install it by copying it to the plugins directory under /var/lib/jenkins folder.

You can also develop your custom plugins. Check out all plugins from the Jenkins Plugin Index

Jenkins Global Security

  • Jenkins’s own user database:- Set of users maintained by Jenkins’s own database. When we say database, its all flat config files (XML files).
  • LDAP Integration:- Jenkins authentication using corporate LDAP configuration.
  • SAML Single Sign On(SSO): Support single signon using providers like Okta, AzureAD, Auth0 etc.

Jenkins credential

In Jenkins, you can save different types of secrets as a credential.
  1. Secret text
  2. Username & password
  3. SSH keys

Jenkins Agent

Jenkins agents are the worker nodes that actually execute all the steps mentioned in a Job. When you create a Jenkins job, you have to assign an agent to it. Every agent has a label as a unique identifier.

When you trigger a Jenkins job from the master, the actual execution happens on the agent node that is configured in the job.

Jenkins server-agent Connectivity

You can connect a Jenkins master and agent in two ways:

Using the SSH method:

 Uses the ssh protocol to connect to the agent. The connection gets initiated from the Jenkins master. Ther should be connectivity over port 22 between master and agent.

Using the JNLP method: 

Uses java JNLP protocol (Java Network Launch Protocol). In this method, a java agent gets initiated from the agent with Jenkins master details. For this, the master nodes firewall should allow connectivity on specified JNLP port. Typically the port assigned will be 50000. This value is configurable.

There are two types of Jenkins agents

Agent Nodes: 

These are servers (Windows/Linux) that will be configured as static agents. These agents will be up and running all the time and stay connected to the Jenkins server. Organizations use custom scripts to shut down and restart the agents when is not used. Typically during nights & weekends.

Agent Clouds:

Jenkins Cloud agent is a concept of having dynamic agents. Means, whenever you trigger a job, a agent gets deployed as a VM/container on demand and gets deleted once the job is completed. This method saves money in terms of infra cost when you have a huge Jenkins ecosystem and continuous builds.


https://devopscube.com/jenkins-pipeline-as-code/

Comments

Popular posts from this blog

Performance Tuning in Mule4 Applications

To achieve optimal performance from your Mule applications, you must evaluate both the applications themselves and the environment in which they run. Although Mule 4 is designed to tune itself, your applications might exhibit performance issues due to their initial construction or dependencies. Similarly, for on-premises installations, you might need to tune the environment itself so that your Mule applications can take full advantage of it. Because many variables influence it, tuning the performance of your application requires some trial and error. You can simplify performance tuning by using documented best practices and testing your applications in ideal test environments. The following recommendations come from the Development and Services Engineering teams and benchmarking efforts by MuleSoft Performance Engineering. Optimizing the performance of your Mule apps requires the following actions: Applying tuning recommendations at the application level        ...

MQ-Based Integration vs. REST API-Based Integration: Choosing the Right Path for Your Architecture

In today's interconnected world, integration is at the heart of seamless operations.  Two of the most popular methods for connecting systems are  1. Message Queue (MQ)-based integration  2. REST API-based integration. But how do you choose the right one for your needs? 🔄 MQ-Based Integration : - Asynchronous Communication : Ensures reliability and resilience, allowing systems to communicate without waiting for an immediate response. Perfect for handling high volumes of data and complex workflows. - Decoupled Systems : MQ allows systems to operate independently, reducing dependencies and enhancing scalability. - Guaranteed Delivery : Messages are queued and delivered even if the destination system is temporarily unavailable, ensuring that no data is lost. 🌐 REST API-Based Integration : - Synchronous Communication : Ideal for real-time, request-response interactions where immediate feedback is needed. - Ease of Use : REST APIs are widely adopted, easy to implement, and pe...

Microservices design patterns

Microservices design pattern Next :  saga-design-pattern-microservices