Day 23: Jenkins Freestyle Project for DevOps ???? ??
What is CICD?
The method of automating the integration of code changes from several developers into a single codebase is known as continuous integration, or CI. It is a software development technique in which the developers often commit their work to the main code repository (Github or Stash). Then, upon integration, there are automatic tools that construct the just contributed code, perform a code review, etc. The main objectives of continuous integration are to detect and fix issues more quickly, make it simpler for a team of developers to integrate their code, increase the quality of the product, and shorten the time it takes to ship new feature updates.
Continuous Delivery (CD) is used after Continuous Integration to ensure that we can swiftly and error-free deploy new modifications to our consumers. To ensure that the final release is functioning properly in production, integration, and regression tests must be run in the staging area, (which simulates the production environment). It makes sure that the release process is automated so that we always have a release-ready product and can deploy our application whenever we want.
What is a Built Job?
The configuration for automating a particular action or phase in the application building process is contained in a Jenkins build job. These duties involve acquiring dependencies, compiling, archiving, or otherwise altering code, as well as testing and delivering code in various settings.
Jenkins supports a variety of build job types, including folders, multibranch pipelines, organization folders, freestyle projects, pipelines, and projects with many configurations.
What is the Freestyle Project?
You can create, test, and deploy software using a range of different settings and configurations using a freestyle project in Jenkins. The following activities are possible when working with a freestyle project in Jenkins:
Task-01
For?your?app,?start?a?new?Jenkins?freestyle?project.
3. Make the project a "Freestyle Project" and give it a name.
4. Click on the "OK" button to create the project.
You can configure the project's specifics, including the source code management system, build triggers, and build actions, on the project configuration page. Your GitHub project repository URL should be entered in GitHub projects.
In the "Source Code Management" section, you can specify the repository location, such as Git, and Select the branch name "main".
In the "Build" section of the project, add a build step to run the "docker build" command to build the image for the container.
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.
领英推荐
By selecting the "Console Output" link in the build page after a build has been completed, you can inspect the console output. This will display the results of the commands that were run throughout the building process.
The produced image and container are visible. Additionally, a GitHub project was deployed to an Ubuntu EC2 instance at /var/lib/jenkins/workspace/jenkins-project-name.
Task-02
Make?a?Jenkins?project?that?will?execute?the?"docker-compose?up?-d"?command?to?launch?the?various?containers?specified?in?the?compose?file.
To?halt?and?delete?the?containers?specified?in?the?compose?file,?set?up?a?cleaning?step?in?the?Jenkins?project?to?execute?the?"docker-compose?down"?command.
1.?Make?a?file?called?dockercompose.yml?inside?of?your?project.
2.?To?halt?and?remove?the?containers?specified?in?the?compose?file,?add?a?build?step?called?"docker-compose?down"?to?the?project's?"Build"?section.?then?add?the?command?"docker-compose?up?-d".
3. Build the project.
4. After a build is completed, you can view the console output.
5. You can see the container is created.
browse ec2-public-ip:8001
Thank you very much; I value your work. You can duplicate the same exercise in your server for learning purposes. Cheers?????