Jenkins Step-by-Step Guide on Crafting a Continuous Delivery and Deployment Pipeline
Tags: jenkins, awschallenge, devops, cicd
Published: 2024-07-10 14:36:34

**What is CI/CD?**
CI/CD stands for Continuous Integration and Continuous Delivery (or Deployment). Continuous Integration is the practice of frequently merging code changes into a shared repository. It involves automating the build, unit testing, and code quality checks to detect issues early. Continuous Delivery focuses on automating the deployment process to make software releases ready for production at any time.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ofttttmffsl24lvwrly6.png)

**What Is a Build Job?**
A Jenkins build job contains the configuration for automating a specific task or step in the application building process. These tasks include gathering dependencies, compiling, archiving, or transforming code, and testing and deploying code in different environments.

Jenkins supports several types of build jobs, such as freestyle projects, pipelines, multi-configuration projects, folders, multibranch pipelines, and organization folders.

**What is Freestyle Projects ??**
A Freestyle Project in Jenkins allows you to create a job without adhering to a strict pipeline structure. It provides a graphical user interface (GUI) where you can configure various build steps, triggers, post-build actions, and more. This approach is especially useful for projects that don't follow a standard build and deployment process or for teams that prefer a more manual and ad-hoc approach to setting up their automation tasks.

**🔹Task-01**
create a agent for your app. ( which you deployed from docker in earlier task

1.In your Jenkins instance, go to "Manage Jenkins" > "Nodes".


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jlp1gfor46gvonad8wcl.png)

2.Click on "New Node" or "New Agent" to create a new agent.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pto31ygc3rkypn2z7nat.png)

3.Provide a name for the agent and select "Permanent Agent".


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ghee0vk69ckk096lplp0.png)

4.Configure the agent settings, such as the number of executors and remote root directory.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sw0qd3q95m119hakck6h.png)

5.Optionally, configure labels to associate with this agent and select "Use WebSocket" Save the configuration.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a0w9xjb2u8i3hva82iah.png)

6.the agent is created.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5srg9zzh2x26pgbaelzj.png)

Create a new Jenkins freestyle project for your app.

1.From the Jenkins dashboard, click on "New Item" to create a new project.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cs8wejsi0m3birzayjgu.png)

2.Enter a project name and select "Freestyle project" Click "OK" to create the project.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/piasyte5o2c3pu0o1rph.png)

In the "Build" section of the project, add a build step to run the "docker build" command to build the image for the container.

1.In the project configuration, navigate to the "Build" section.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i7mvg9sj9rajp94fsgd9.png)

2.Click on "Add build step" and select "Execute shell" (or the relevant option for your environment).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/14x43fmozgbqphxdk9ax.png)


3.In the "Execute shell" build step, add the command to build the Docker image for your app. Replace <app_directory> with the actual directory of your app


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ljgmbq53ctp0iapjy0fx.png)

4.Save the project configuration.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tabt0qtvqidntyit3fh7.png)