Day 23 Task: Jenkins Freestyle Project for DevOps Engineers.

Day 23 Task: Jenkins Freestyle Project for DevOps Engineers.

What is CI/CD?

CI or Continuous Integration is the practice of automating the integration of code changes from multiple developers into a single codebase. It is a software development practice where the developers commit their work frequently into the central code repository (Github or Stash). Then there are automated tools that build the newly committed code and do a code review, etc as required upon integration. The key goals of Continuous Integration are to find and address bugs quicker, make the process of integrating code across a team of developers easier, improve software quality and reduce the time it takes to release new feature updates.


CD or Continuous Delivery is carried out after Continuous Integration to make sure that we can release new changes to our customers quickly in an error-free way. This includes running integration and regression tests in the staging area (similar to the production environment) so that the final release is not broken in production. It ensures to automate the release process so that we have a release-ready product at all times and we can deploy our application at any point in time.

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 is a type of project that allows you to build, test, and deploy software using a variety of different options and configurations. Here are a few tasks that you could complete when working with a freestyle project in Jenkins.

Task-01

Create a new Jenkins freestyle project for your app.

  1. Log in to Jenkins and navigate to the main dashboard.
  2. Click on the "New Item" button to create a new project.

No alt text provided for this image

3. Select "Freestyle project" and give the project a name.

4. Click on the "OK" button to create the project.

No alt text provided for this image


In the project configuration page, you can specify the details of the project, such as the source code management system, build triggers, and build actions. In GitHub project write your GitHub project repository URL.


No alt text provided for this image

In the "Source Code Management" section, you can specify the repository location, such as Git and Select branch name "main"

No alt text provided for this image


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

No alt text provided for this image

Add a second step to run the "docker run" command to start a container using the image created in step 3.

No alt text provided for this image

Click on the "Save" button to save the project configuration.

Build the project: You can manually build the project by clicking on the "Build Now" link in the project's main page. This will start the build process and execute the steps specified in the project configuration.

No alt text provided for this image

After a build is completed, you can view the console output by clicking on the "Console Output" link in the build page. This will show the output of the commands that were executed during the build


No alt text provided for this image

You can see image and container is created. also project from GitHub deploy to ubuntu EC2 instance at location /var/lib/jenkins/workspace/jenkins-project-name.

No alt text provided for this image


No alt text provided for this image


Task-02

Create Jenkins project to run "docker-compose up -d" command to start the multiple containers defined in the compose file

Set up a cleanup step in the Jenkins project to run "docker-compose down" command to stop and remove the containers defined in the compose file.

1.Create docker-compose.yml file inside your project

No alt text provided for this image

2. In the "Build" section of the project, add a build step "docker-compose down" command to stop and remove the containers defined in the compose file. then add "docker-compose up -d" command.


No alt text provided for this image

3. Build the project.

4. After a build is completed, you can view the console output.

No alt text provided for this image

5. You can see container is created.

No alt text provided for this image

browse your-ip:8001

No alt text provided for this image

Thank you for reading!

Shubham Londhe

Helping Students and Professionals build their Careers | Experience in DevOps | Python | AWS | PySpark | SQL | NoSQL | 1000+ Learners placed

2 年

this is amazing ?? nicely documented

要查看或添加评论,请登录

Sayali Shewale的更多文章

  • DevOps Project-3

    DevOps Project-3

    Project Description The project involves hosting a static website using an AWS S3 bucket. Amazon S3 is an object…

    7 条评论
  • DevOps Project-2

    DevOps Project-2

    Project Description The project is about automating the deployment process of a web application using Jenkins and its…

    2 条评论
  • Day 80: DevOps Project-1

    Day 80: DevOps Project-1

    Project Description The project aims to automate the building, testing, and deployment process of a web application…

    4 条评论
  • Day 73 - Setup Grafana on AWS EC2 Instance

    Day 73 - Setup Grafana on AWS EC2 Instance

    Task: Setup grafana in your local environment on AWS EC2. Go to the AWS console and Launch an EC2 instance Open port…

    2 条评论
  • Day 72 - Grafana

    Day 72 - Grafana

    What is Grafana? Grafana is an open-source data visualization and monitoring tool that allows you to query, visualize…

    3 条评论
  • Day 70 - Terraform Modules

    Day 70 - Terraform Modules

    Modules are containers for multiple resources that are used together. A module consists of a collection of .

    2 条评论
  • Day 69 - Meta-Arguments in Terraform

    Day 69 - Meta-Arguments in Terraform

    When you define a resource block in Terraform, by default, this specifies one resource that will be created. To manage…

    1 条评论
  • Day 68 - Scaling with Terraform

    Day 68 - Scaling with Terraform

    Understanding Scaling Scaling is the process of adding or removing resources to match the changing demands of your…

  • Day 67: AWS S3 Bucket Creation and Management using terraform

    Day 67: AWS S3 Bucket Creation and Management using terraform

    AWS S3 Bucket Amazon S3 (Simple Storage Service) is an object storage service that offers industry-leading scalability,…

    1 条评论
  • Day 66 - Terraform Hands-on Project - Build Your Own AWS Infrastructure with Ease using Infrastructure as Code (IaC)

    Day 66 - Terraform Hands-on Project - Build Your Own AWS Infrastructure with Ease using Infrastructure as Code (IaC)

    Task: 1.Create a VPC (Virtual Private Cloud) with CIDR block 10.

    3 条评论

社区洞察

其他会员也浏览了