What is CI/CD?
CI (Continuous Integration) is the practice of automating the process of merging code changes from multiple developers into a shared codebase. Developers frequently commit their code to a central repository (like GitHub, GitLab, or Bitbucket). Automated tools then build the code and perform tasks such as syntax checks, running tests, and code quality reviews. The primary goals of Continuous Integration are:
To catch and fix bugs early in the development cycle.
To simplify the process of integrating changes from multiple developers.
To improve the overall quality of the software.
To accelerate the delivery of new features by reducing delays caused by integration issues.
CD (Continuous Delivery) takes the next step after Continuous Integration. It ensures that the application is always in a deployable state and can be released to customers quickly and reliably. This process involves running integration and regression tests in an environment similar to production (staging) to confirm stability before deployment. Continuous Delivery automates much of the release pipeline, reducing human intervention and minimizing errors. This allows teams to deploy updates or new features with confidence whenever needed.
Together, CI/CD is a cornerstone of modern DevOps practices, enabling faster and more reliable software delivery.
What Is a Build Job in Jenkins?
A build job in Jenkins is a configuration that automates specific tasks or steps in the process of building, testing, and deploying an application. These tasks might include:
Gathering dependencies.
Compiling the code.
Archiving build artifacts.
Running automated tests.
Packaging and deploying the application to different environments.
Jenkins supports various types of build jobs to suit different workflows and use cases, such as:
Freestyle Projects – Basic projects with customizable build steps.
Pipelines – Advanced, code-based workflows for CI/CD.
Multibranch Pipelines – Pipelines for managing multiple branches of a repository.
Multi-Configuration Projects – For running builds with different configurations (e.g., OS or dependency versions).
Folders and Organization Folders – For grouping and managing related jobs at scale.
What is a Freestyle Project? 🤔
A Freestyle Project in Jenkins is the simplest type of project, designed for users who want a straightforward way to build, test, and deploy software. It provides a flexible interface to configure a sequence of tasks that can include:
Building your code (e.g., compiling a Java or C++ application).
Running tests to verify your code's functionality.
Deploying the built application to a test or staging environment.
With freestyle projects, you can:
Easily configure different build steps through the Jenkins UI.
Integrate source control systems like GitHub or Bitbucket.
Add plugins to customize the build process.
Trigger builds automatically based on events like code commits or time schedules.
While freestyle projects are ideal for simple tasks, for more complex workflows or dynamic configurations, Pipeline jobs are generally preferred.
Task :- Created a freestyle project with jenkins.
- Cloned project from github:-
Provided required permissions:-
Created an agent for app.
Created a new Jenkins freestyle project for your app.
In the "Build" section of the project, added a build step to run the
docker build
command to build the image for the container.Added a second step to run the
docker run
command to start a container using the image created in the previous step.
Please note that jenkins and docker is installed on your instance.
Output:-
Accessed the Todo app using the instance's IP address on port 8000.