Day 23 : 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 agent for your app.
- Create a new Jenkins freestyle project for your app.
Click on "New Item" on the Jenkins dashboard.
Provide a name for your project
Provide a brief description of your project.
If your project involves source code management, configure your version control system (e.g., Git, SVN) settings here.
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.
Go to Jenkins-project < build < console Output
To allow access to your application running on port 8000 after a successful Jenkins build, you typically need to ensure that your application server is configured to listen on port 8000 and that any necessary firewall rules or security groups are configured to allow incoming traffic on that port.
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)
1. Install docker-compose (if not installed)
- Go to Jenkins-project < build < console Output
- 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.
Go to Jenkins-project < build < console Output
Thank you for reading :-)
Priyanka varshney
Subscribe to my newsletter
Read articles from priyanka varshney directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
priyanka varshney
priyanka varshney
๐ Hello, and welcome to my DevOps journey! ๐ I am Priyanka Varshney,๐ ๏ธ As an aspiring DevOps engineer, I'm all about bridging the gap between development and operations, making software delivery seamless and efficient. ๐ป๐ง On this Hashnode blog, I'll be sharing my learnings, experiences and adventures as I dive deep into the world of continuous integration, automation, and cloud technologies. โ๏ธโ๏ธ Let's connect, learn, and grow as a vibrant DevOps community. Follow my Hashnode blog, and let's embrace the DevOps adventure together! ๐ค๐