Introduction:
In the dynamic realm of DevOps, where speed, collaboration, and automation converge, Jenkins stands as a pillar of innovation. As DevOps engineers, our quest for streamlined workflows and efficient software delivery leads us to explore the remarkable world of Jenkins Freestyle Projects. In this blog post, we embark on a journey to unravel the intricacies of Jenkins Freestyle Projects, dive into the essence of CI/CD pipelines, understand the significance of "Build Now," and even touch on the horizon of Continuous Deployment. So, buckle up as we venture into the heart of DevOps automation! ๐
What is CI/CD?
Continuous Integration- 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 to 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.
Continuous Delivery: 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.
Continuous Deployment: Continuous deployment is a strategy in software development where code changes to an application are released automatically into the production environment. This automation is driven by a series of predefined tests. Once new updates pass those tests, the system pushes the updates directly to the software's users.
What is 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 ?? ๐ค
Jenkins Freestyle Projects transcend mere tools; they embody the art of orchestration. Envision the ability to shape build steps, triggers, post-build actions, and deployment mechanisms โ all meticulously tailored to your project's nuances. This flexibility empowers us to craft a seamless CI/CD pipeline, fostering collaboration and efficiency within our teams.
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.
Task 1: Create an agent for your app.
Step 1: Go to Manage Jenkins and click on Set an Agent.
Step 2: Give an agent node name and choose permanent agent then click on create.
Step 3: Give a specific name, description and remote directory to it.
Step 4: Just fill in the required info and then save it.
Step 5: Flask-todo-app-node agent is created.
Create a new Jenkins freestyle project for your app.
Step 1: Enter an item name and choose a freestyle project.
Step 2: Provide a description and choose Github project also add Project url.
Step 3: Add the repository URL of your GitHub project.
Step 4: 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 another step to run the "docker run" command to start a container using the image created.
Step 5: Click on Build Now.
Step 6: Run the server on port 5000.
Task-02
Create a Jenkins project to run the docker-compose up -d" command to start the multiple containers defined in the compose file.
Follow the following steps-
Now save and click on Build now:
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.
Conclusion:
As DevOps practitioners, our quest for excellence is boundless. Jenkins Freestyle Projects serve as our chisel, carving a path through the DevOps landscape where automation, teamwork, and rapid delivery thrive. Armed with insights into Freestyle Projects, CI/CD pipelines, "Build Jobs," and glimpses of Continuous Deployment, we're poised to elevate our DevOps practices.