Day 23 Task: Jenkins Freestyle Project for DevOps Engineers.

Day 23 Task: Jenkins Freestyle Project for DevOps Engineers.

In today's fast-paced world of software development, efficiency and speed are paramount. Continuous Integration and Continuous Deployment (CI/CD) have emerged as indispensable practices to streamline the software development lifecycle.

What is CI/CD?

  • Continuous Integration (CI): Integrating code changes into a shared repository frequently, often several times a day. This practice aims to detect errors early in the development cycle.

  • Continuous Delivery (CD): Automating the deployment process to deliver code changes to production or staging environments reliably and quickly.

Benefits of CI/CD:

  • Faster Time to Market: Automating build, test, and deployment processes accelerates the delivery cycle.

  • Early Bug Detection: CI/CD catches bugs early in the development process, reducing debugging time.

  • Cost Efficiency: Automating repetitive tasks minimizes manual effort and saves costs.

  • Consistent Quality: With automated testing and deployment, the software maintains a consistent level of quality.

  • Increased Collaboration: CI/CD fosters collaboration among development, operations, and quality assurance teams.

What Is a Build Job?

  • A build job is a task within a CI/CD pipeline responsible for compiling, testing, and packaging code.

  • It fetches the latest code from the repository, compiles it, runs automated tests, and generates artifacts for deployment.

Types Of Jobs in Jenkins:

  1. Freestyle Projects:

    • Definition: Freestyle projects in Jenkins allow you to configure a build job with a combination of build steps and actions.

    • Flexibility: Offers complete freedom to define build steps, including shell commands, batch scripts, or custom actions.

    • Use Cases: Ideal for simple projects or scenarios where flexibility in configuring build steps is crucial.

  2. Pipeline Jobs:

    • Definition: Pipeline jobs define the entire build process using a script written in Jenkinsfile.

    • Declarative or Scripted: Supports both declarative and scripted syntax for defining pipelines.

    • Reusability: Encourages code reuse through defining pipelines as code, facilitating easier maintenance and collaboration.

  3. Multi-configuration Projects:

    • Definition: Allows running the same build job with different configurations, such as different operating systems or environments.

    • Matrix Builds: Executes build steps across multiple axes, enabling comprehensive testing across various configurations simultaneously.

    • Efficiency: Saves time by running tests in parallel across different configurations.

TASK-1

  • create a 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.

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

  1. Click on New Item then you will enter into Free Style project.

  2. Give the name Free Style project Name node-todo-cicd add description etc.

TASK-2

  • 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 "docker-compose down" command to stop and remove the containers defined in the compose file.

    In conclusion, CI/CD revolutionizes software development by automating processes, enhancing quality, and speeding up delivery. Jenkins, with its versatile job types like Freestyle Projects, empowers teams to build, test, and deploy software efficiently. Embrace the power of CI/CD and Jenkins to propel your development workflows into the future.