Jenkins

akhil mittal - Sep 18 - - Dev Community

Who or What is Jenkins

Jenkins is a free and open-source CI/CD server. The Java-based application serves as a platform for development, testing, and release.

Image description

So, Why Jenkins ?

Gitlab CI/CD, GitHub CI/CD, CircleCI, Travis CI, Bitbucket pipeline, etc. are just a few of the CI/CD technologies poopularly used. Depending on the situation, several tools can be used to their full potential. However, Jenkins has a few advantages that makes it preferable in comparison to its rivals.

To begin, as we shall see when we perform the setup, installation and configuration are quick and easy. The platform's web-based administration is user-friendly, allowing for a wide range of customization in construction processes. For more versatility and personalization, it makes use of a plugin ecosystem. Scalability is provided via Jenkins' decentralised build agents and executors. Finally, the thriving community of users and thorough online documentation are invaluable resources.

The Jargon of Jenkins

Image description

1. Jenkins Master Node
The Jenkins administrative dashboard is hosted on the Jenkins controller/master. It provides a web-based administrative portal for setting up build jobs, pipelines, and plugins. The master coordinates the scheduling and distribution of build jobs to the build agents.

2. Jenkins Build Agent
A build agent, also called a slave, is a dedicated server that the Jenkins master communicates with by sending it build task dispatches. As shown in the above graphic, each Agent is capable of running its own OS.

3 .Web Interface
A user-friendly interface for managing jobs, viewing build results, and configuring Jenkins settings.

4. Job Configuration
Jobs (or projects) can be configured through the web interface, specifying how to build, test, and deploy software. Jobs can be triggered by various events (e.g., SCM changes, cron schedules).

5. Plugins
Jenkins has a robust plugin architecture that allows for the integration of various tools and services (like Git, Docker, and JUnit). The extensive plugin ecosystem enhances Jenkins’ functionality, enabling it to cater to diverse CI/CD needs.

6. Build Queue
When jobs are triggered, they are placed in a queue. The master node manages this queue and allocates jobs to available agents based on resource availability and job priorities.

7. Build Artifacts
During the build process, Jenkins can produce artifacts (e.g., compiled code, documentation). These artifacts can be archived for later use or deployment.

8. Build Project
The Build project defines the parameters for a specific software's build setup. There are different build requirements for different project types. The default build project on Jenkins are:

  • Freestyle project
  • Pipeline
  • Multi-configuration project
  • Folder
  • GitHub Organization
  • Multibranch Pipeline
  • Each project choice is described in detail on the Jenkins UI.

9. Label
Grouping together various build agents based on user-defined metadata. Labels can be used to categorise Build Agents in a variety of ways, such as by operating system or by type of build technology.

10. Node
Labels all machines that can run a given build pipeline or project. The location of the execution can now be determined. Scripted pipelines make use of nodes.

11. Agent
Labels all machines that can run a given build pipeline or project. The location of the execution can now be determined. The Declarative pipeline employs agents.

12. Artifact
Created document when a construction has been completed. It could be a.NET assembly, a Java JAR, or even a simple ZIP archive. Artefacts are considered immutable and should not be changed outside of the construction process that originally created them. A fingerprint, which is a checksum of the relevant Artefact file, is used for tracking and tracing purposes.

13. Pipeline
A pipeline is a modelling concept that represents and encapsulates the fundamental building logic and process. Jenkins offers two distinct syntaxes for constructing pipelines:

- Declarative Pipelines
A Syntax with a strong point of view; the rules are more clearly laid out and rigid. They're less adaptable than scripted pipelines, but they're simpler to use if you don't know Groovy.

- Scripted Pipelines
Developed using the Groovy programming language, it allows you to make highly individualised processing pipelines. However, you will need Groovy expertise to get anything done. Those in charge of building and releasing software who aren't familiar with Groovy may not want to go through the additional learning curve.

Nowadays, declarative pipelines are more used as it is easier to learn and works with most SCM tools such as Gihub, Bitbucket and more.

Automated methods known as a CI/CD (Continuous Integration/Continuous Deployment) pipeline are used to continually integrate code changes, build and test applications, and deploy them to production. Getting updates out to users quickly and reliably is the main focus of a CI/CD workflow.

The various steps that make up a typical CI/CD pipeline are as follows:

Code Integration: In this stage, developers combine their individual code updates into a central repository.
Build: In this stage, the CI system compiles the code and executes any tests at this point.
Test: This phase involves running various tests on the code, such as unit tests, integration tests, and full-stack tests.
Deployment: In this stage, The code is released into a live (prod) or test (staging) environment
Monitoring: This is usually the last stage. At this stage, the system checks in on the running application to make sure everything is running smoothly.

14. Stage
Used to divide the entire pipeline into smaller, more manageable chunks. Identifying discrete phases has various advantages:

Provides the framework for the pipeline's creator to implement order.
Used to display build status as the build is being executed.
Clone, Build, Test, Packaging, and Deployment are all examples of typical phases in the CI/CD lifecycle.

A pipeline stage can be made up of many pipeline steps.

15. Step
A pipeline step specifies a single build task and what should occur. A pipeline stage often encompasses several pipeline phases.

16. Workspace
A dedicated file system directory where build work for the current pipeline or build process is conducted. When debugging builds, this directory and its subdirectory structure are useful to investigate. The workspace will be generated on the build agent that the pipeline or build job is configured to run on.

17. Downstream
This refers to another pipeline or build job that will be triggered as a result of the current pipeline or build job.

18. Upstream
This job refers to the pipeline that started the current pipeline or build job.

Jenkins Configuration
A blog post on how to install Jenkins on AWS can be found here.

Remember to save the "initialAdminPassword" value for the first time you log in.

Image description

Image description

To install commonly used plugins, select Install suggested plugins:

Image description

After downloading the plugins, enter your credentials and click "Save and Continue" to access your dashboard.

Image description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .