Table of contents
In the previous blog, I explained what CI/CD is. Here’s the link to my blog: CI/CD. If you haven’t already installed Jenkins on your server, here are the steps to Install Jenkins on your system.
What Is a Build Job?
A build job in Jenkins is a defined task that automates the process of compiling, testing, and packaging software code, resulting in executable artifacts. It's a fundamental part of a continuous integration and continuous delivery (CI/CD) pipeline, ensuring consistent and efficient software development and deployment.
In Jenkins, you can create various types of build jobs to accommodate different stages and tasks within your software development lifecycle. Here are some common types of build jobs you might encounter:
Freestyle Project: This is a basic build job where you configure build steps, such as compiling code, running tests, and packaging artifacts.
Pipeline Job: Jenkins Pipeline is a powerful way to define your entire build, test, and deployment process as code. It provides greater flexibility, extensibility, and reusability compared to freestyle projects.
Multi-configuration Project: Also known as a matrix build, this type of job runs the build process on multiple configurations, such as different operating systems or versions of a programming language.
Parameterized Job: You can create build jobs that accept parameters during execution. This allows you to customize the build process based on user input or predefined settings.
Scheduled Job: These jobs are triggered at specific intervals or times, regardless of code changes. They're useful for tasks like regular backups, cleanups, or periodic reports.
Folder: While not exactly a build job, folders in Jenkins help organize jobs into a hierarchical structure, making it easier to manage larger numbers of jobs.
Multibranch pipelines: These allow you to create pipelines that are based on branches in a Git repository.
Organization folders: These allow you to organize your build jobs by organization.
In this blog, I am going to do a Freestyle Project. Let’s learn what a freestyle project is.
What is Freestyle Projects?
A freestyle project in Jenkins is a type of build job that allows you to define the steps that are executed in the build process. Freestyle projects are the most basic type of build job in Jenkins, and they are a good starting point for building more complex pipelines.
Here are a few tasks that you could complete when working with a freestyle project in Jenkins:
Task-01
- Create an agent for your app. ( which you deployed from docker in earlier task)
- Create a new Jenkins freestyle project for your app.
- In the "Build" section of the project, add a build step to run the "docker build" command to build the image for the container.
docker build . -t django-app
docker run -d -p 8001:8001 django-app
Access the app through the URL.
Task-02
- Create Jenkins project to run "docker-compose up -d" command to start the multiple containers defined in the compose file (Hint- use day-19 Application & Database docker-compose file)
-
Set up a cleanup step in the Jenkins project to run the "docker-compose down" command to stop and remove the containers defined in the compose file.
Thank you for your reading. Happy Learning!!!😊