Jenkins

Kajanan19
5 min readAug 6, 2021

| What is Jenkins?

Jenkins is a continuous integration tool used to build(compile, test) code and deploys it to production. Jenkins provides hundreds of plugins to support building, deploying, and automating any project. It is a server-based system that runs in servlet containers such as Apache Tomcat. It supports version control tools like SVN, Git to automate the build

| Continuous Integration

continuous-integration is a process in which all development work is integrated as early as possible. The resulting artifacts are automatically created and tested. This process allows identifying errors as early as possible.

| Why Continuous Integration?

| The problem before continuous integration

| Continuous Integration workflow

| How to install Jenkins in Windows?

Step 1

Go to the official website of Jenkins

https://www.jenkins.io/

Step 2

Download the Jenkins Long term Support Generic Java Package(War)

Step 3

Open the Command prompt in the downloaded folder and follow the command

java -jar jenkins.war

Step 4

You can see the Dashboard on 8080 port (http://localhost:8080/), when you run on the first time it will auto-generate a password on cmd.

Step 5

After invoking port 8080, Provide that auto-generate a password on Jenkins Home

after that select the install suggested plugins

Once the installation is finished, you can see the Account setup

when you finish your account setup, you can see the Jenkins Dashboard\

Step 6

Let’s move to continuous integration and Deployment, Create a Spring boot project (Spring-Jenkins) only with web dependency, and add the print statements mentioned below in the Main class

public static Logger logger= LoggerFactory.getLogger(AngularSetup1Application.class);@PostConstruct
public void intt() {
logger.info("Application Started");}
public static void main(String[] args) {
logger.info("Application executed");
SpringApplication.run(AngularSetup1Application.class, args);}

Then add this satements in test package also

public static Logger logger= LoggerFactory.getLogger(AngularSetup1ApplicationTests.class);@Test
void contextLoads() {
logger.info("Test case executing...");
logger.info("Test second case executing");
assertEquals(true, true);
}

Step 7

Create a New repository with the same project name which you used in IDE in Github and click create repository

Step 8

Go to your Project folder, Open the Gitbash and Initialize git through this command

git init

Then check the status of the Project and add, commit and push to your repository

git status 
git add *
git commit "Commit Message"
git remote add origin <<paste the link here>>
git push -u origin master

Step 9

Now go to the Jenkins Dashboard and Create the new job

Then add the project name and Click on Free Style Project, then Click ok

Then give the Description, Click on GitHub project and give the Project URL

After That Click on Git for Source code management and provide the Repository URL

after that you have to click on add and have to provide your jenkins Credential

and if you want to Shedule the build , click on Pol SCM and provide the Shedule according to the standards

Then Click on Add Build Step, Provide invoke top-level marven targets and give the goal as install

Then Click on Post-build Action, Select Email Notification and provide your email address and Click Apply.

Now Go to Home and Click on our Project

Then Select Build Now Option and you can see the build on Jenkins with the console output

Step 10

You Can Make the changes on Project Code base and push it to the repository again and then the automatic build will happen in Jenkins(every commit to the repository will automatically start the build on jenkins), So Jenkins can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.

Before Jenkins The entire source code was built and then tested. Locating and fixing bugs in the event of build and test failure was difficult and time-consuming, which in turn slows the software delivery process.

After Jenkins Every commit made in the source code is built and tested. So, instead of checking the entire source code developers only need to focus on a particular commit. This leads to frequent new software releases.

Before Jenkins Developers have to wait for test results.

After Jenkins Developers know the test result of every commit made in the source code on the run

Before Jenkins The whole process is manual.

After Jenkins You only need to commit changes to the source code and Jenkins will automate the rest of the process for you.

Thank you…

--

--

Kajanan19

My career objective is “To be the best that I can be and make a significant contribution".