0% found this document useful (0 votes)
29 views9 pages

Jenkins Essentials: Setup & CI/CD Guide

Jenkins is a Continuous Integration (CI) tool that automates code testing and deployment processes, facilitating collaboration between developers and testers. It supports Continuous Delivery (CD) by ensuring that software is rapidly deployed to production after testing. The document also provides a detailed installation guide for Jenkins, outlining steps for setup and usage.

Uploaded by

suresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views9 pages

Jenkins Essentials: Setup & CI/CD Guide

Jenkins is a Continuous Integration (CI) tool that automates code testing and deployment processes, facilitating collaboration between developers and testers. It supports Continuous Delivery (CD) by ensuring that software is rapidly deployed to production after testing. The document also provides a detailed installation guide for Jenkins, outlining steps for setup and usage.

Uploaded by

suresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Jenkins Essentials: A Beginner's Guide to

Fundamentals and Installation


What is Jenkins?

• Jenkins is a Continuous Integration (CI) tool that automates the process


of pulling code from remote repositories and running tests on it.
• Continuous Integration (CI) refers to the practice of integrating
development and testing activities together, ensuring smooth
collaboration between developers and testers.

CI Process in Detail

1. Development and Testing Cycle:

• Developers push their code daily to a remote repository.


• The DevOps team builds the code overnight and provides a new build to
testers for the next day.
• This cycle repeats continuously.

2. Automation in CI:

• Automation testers also update and push their test scripts to a remote
repository daily.
• Jenkins automatically pulls the latest code from these repositories and
executes the automated tests on it.

What is CD (Continuous Delivery/Deployment)?

1. Definition of Continuous Delivery (CD):

• Continuous Delivery (CD) is the process where software is continuously


deployed to the production environment after testing.
• It ensures that once testing is complete, the code is released quickly to
the customer.
2. Difference Between CI and CD:

• CI (Continuous Integration): Focuses on continuous development and


testing in local environments.
• CD (Continuous Deployment): Focuses on deploying the code to the
production environment after testing.

Role of Jenkins in CI/CD

Jenkins in Automation:

• Developers and testers each maintain their own GitHub repositories.


• Jenkins pulls the latest code from the developer's GitHub repository to
create a build. This is typically the application code that needs to be
tested.
• Once the build is created, Jenkins then pulls the tester’s GitHub
repository, which contains the automated test scripts.
• Jenkins executes these automated tests on the testing environment,
ensuring that the code is continuously tested against the latest changes.

Packaging and Certification:

• Once Jenkins pulls the latest code from the developer’s repository and
creates a build, it then packages the software (preparing it for
deployment).
• After that, Jenkins pulls the automated test scripts from the tester’s
repository and executes them on the build.
• If the automation tests pass, the build is considered certified and ready
for deployment to the production environment.

Let's Understand What a Pipeline in Jenkins Is

A Jenkins pipeline automates the entire process of software development and


testing. When developers make changes, Jenkins builds the code, while
automation testers ensure their test scripts are executed. This cycle includes
building, testing, packaging, and deployment. CI/CD ensures continuous
integration and testing, making the process seamless and efficient for both
development and testing teams.
Now, let’s look at how this pipeline brings developers and testers together:

• The Developer's Role: The developer pushes their latest code changes to
a GitHub repository. Once that happens, Jenkins steps in and pulls the
latest version of the code to begin building the application.
• The Tester's Role: Meanwhile, testers have their automated test scripts
stored in a separate repository. After Jenkins finishes building the code,
it retrieves these test scripts, runs the tests, and checks whether the
new changes meet the required standards.

In this way, developers and testers collaborate effortlessly, ensuring that the
software is continuously built, tested, and ready for deployment.

Jenkins' Headless Testing

• Jenkins, by default, follows headless testing, which means it runs tests


without the need for a GUI.
• This is efficient for running automation scripts in a CI/CD pipeline.
Jenkins Installation Guide

Steps:

1. Download Jenkins WAR File:


o Go to the Jenkins download page and download the Jenkins WAR
file.

2. Open Terminal and Navigate to Jenkins Location and Run Jenkins:


o Open Terminal and navigate to the folder where the [Link]
file is located.
o Use the following command to start Jenkins:
o java -jar [Link]

3. Password Generation:
o After running the command for the first time, Jenkins will generate a
temporary password in the console.
o If you miss the password, you can retrieve it from the location
mentioned in the console where it says, "This may also be found
at...".

Note: The password is used to unlock Jenkins on your local system.


4. Check If Jenkins Is Running:
o Once Jenkins is up and running, the terminal will display the
message confirming it.

o Jenkins runs on localhost:8080 by default.


5. Access Jenkins in Browser
o Open your web browser and go to:
o [Link]

Unlock Jenkins

• You will be prompted to enter the password you found in the terminal.
• Provide the password to unlock Jenkins.
Install Suggested Plugins

• After unlocking Jenkins, click on Install suggested plugins.

• Wait for Jenkins to install all the required basic plugins.

6. Set Up Jenkins Admin User

• After the plugins are installed, Jenkins will redirect you to a page where
you need to set up your username, password, and email address.
7. Complete Setup

• After completing the setup, Jenkins will be ready to use.


• Bookmark the localhost:8080 URL for easy access later.
Click on Start using Jenkins it will open the Jenkins Dashboard

Jenkins Dashboard

Only the first time you set up Jenkins, it will provide a password to unlock it.
After that, you can start Jenkins by running the following command in the
terminal from the directory where the [Link] file is located:

java -jar [Link]

Then, open the localhost server (usually [Link] and provide


your username and password to access Jenkins.
Using Jenkins with .war File

Every Time You Start Jenkins:

• Open your Terminal and go to the directory where the [Link] file is
located.
• Run the following command:

java -jar [Link]

Note: If you close the terminal, the Jenkins process will stop. So, make sure the
terminal stays open while you are working with Jenkins in this mode.

Using Jenkins with Executable File

Every Time You Start Jenkins:

• Double-click the Jenkins installer (executable file) on your system.


• Jenkins will automatically start and run in the background.

Note: Unlike the .war file, when using the executable file, Jenkins will continue
running in the background even after closing the terminal or the command
window.

Common questions

Powered by AI

Jenkins automates the software development life cycle starting from pulling the latest code from the developer’s GitHub repository to create a build. This initial stage ensures that the newest code changes are tested . Next, Jenkins retrieves automated test scripts from the tester’s repository and runs these tests on the build. This stage verifies that the code changes meet the required quality standards and don't introduce new issues . Finally, after passing all tests, Jenkins packages the software, certifying the build as ready for deployment. This complete cycle enhances efficiency, ensures code stability, and significantly reduces time to market by automating repetitive tasks and maintaining code integrity across stages .

Installing Jenkins using a .war file involves manually navigating to the file's directory and executing it with the command 'java -jar jenkins.war' . This approach requires the terminal to remain open, as closing it stops the Jenkins process . Conversely, using an executable file involves simply double-clicking the installer, after which Jenkins runs automatically in the background, independent of any open command or terminal windows . The operational implication is that the executable installation provides a more user-friendly experience with less risk of unintentional shutdown, whereas the .war file requires continuous terminal management, which may not be as convenient for all users .

Jenkins' pipeline system enhances continuous collaboration by automating the integration of development and testing activities. It facilitates the building of application code upon developers pushing updates to the repository, followed by running automated test scripts from testers to verify code quality. This automatic transition from development to testing ensures that both teams are always working with the latest version on tasks pertinent to their roles . By doing so, Jenkins reduces manual hand-overs, minimizes errors, and accelerates feedback loops, which collectively enhance software quality and decrease time to delivery, improving overall project outcomes through seamless collaboration .

Jenkins significantly enhances the continual delivery of high-quality software products by bridging the gap between developers and testers through automation. For developers, Jenkins automates the build and initial testing processes, allowing them to focus on writing code without interruptions caused by integration issues . For testers, Jenkins enables frequent and consistent execution of test scripts against the latest code builds, thereby assuring code quality before deployment . This synergy between developing and testing facilitates rapid detection and resolution of errors, speeds up development cycles, and ultimately results in the delivery of robust software. The automation and integration Jenkins provides ensure a synchronized workflow, where high-quality releases are systematically prepared for production, thus maintaining constant delivery of quality products to end-users .

Automation testers play a critical role in the Jenkins CI/CD pipeline by developing and maintaining test scripts stored in a separate repository. Jenkins retrieves these scripts and executes them automatically after building the application code . The primary contribution of automation testers is ensuring that every code change is rigorously tested against defined requirements and standards, thus identifying defects early in the development cycle. Their continuous feedback on code quality leads to quicker iterations and enhanced software resilience . This automated and continuous testing framework speeds up the software release process, dramatically reducing time and effort compared to manual testing, and increases overall development efficiency and code reliability .

Continuous Integration (CI) and Continuous Delivery (CD) both aim to expedite software delivery, but they address different aspects of the development pipeline. CI focuses on integrating and testing code changes frequently by automating these processes locally to detect faults early, which Jenkins facilitates through automatic pulling of code and running tests . On the other hand, CD goes a step further by ensuring that code is ready for deployment to production environments post-testing, a process Jenkins also automates by handling the deployment pipeline after successful testing . While CI ensures that code changes are continuously validated, CD ensures the readiness of the validated code for production use, with Jenkins providing support across both stages .

To install Jenkins, the following steps are required: 1. Download the Jenkins WAR file from the Jenkins download page. This file is necessary to run Jenkins on the local system . 2. Run 'java -jar jenkins.war' from the terminal, navigating first to where the file is saved. This command starts Jenkins . 3. Retrieve the temporary password from the console to unlock Jenkins initially . 4. Open a web browser and go to 'http://localhost:8080' to access Jenkins. This URL connects to the local Jenkins server . 5. Input the password to unlock Jenkins and install suggested plugins that provide essential functionalities . 6. Set up an admin user account to secure access and complete setup to use Jenkins . These steps configure Jenkins for initial use, setting up necessary components and security features .

Jenkins facilitates headless testing by executing tests without a graphical user interface (GUI), which is a default configuration in Jenkins . This approach is highly beneficial in a CI/CD pipeline because it reduces resource consumption and allows tests to be run more quickly and efficiently. Headless testing is particularly advantageous for running automation scripts continuously and rapidly in server environments where GUI components are unnecessary, thus speeding up the testing process and conserving system resources .

Jenkins is primarily used in CI to automate the integration of development and testing activities, facilitating collaboration between developers and testers. It automates the process by pulling code from remote repositories and executing automated tests on it, ensuring continuous testing and integration . In the context of CD, Jenkins extends its role by deploying the software to the production environment after successful testing, thus enabling a seamless release to customers . By automating these processes, Jenkins enhances the software development cycle by promoting efficient collaboration, speeding up testing and deployment, reducing manual errors, and ensuring high-quality software releases .

Challenges of using Jenkins include managing complex pipelines, ensuring plugin compatibility, and handling system resource constraints, which can affect Jenkins' performance and reliability . To mitigate these challenges, strategies include: 1. Proper pipeline configuration to manage complexity and ensure code is processed efficiently without unnecessary steps . 2. Regularly updating Jenkins and plugins to maintain compatibility and leverage new features or security fixes . 3. Scaling Jenkins infrastructure to match project size and increasing resources to handle larger workloads . 4. Incorporating pipeline as code, which improves maintainability and version control . Deploying these strategies can enhance Jenkins' robustness, maintainability, and performance in CI/CD pipelines .

You might also like