Introduction To Jenkins
Jenkins is an open-source Continuous Integration, cross-platform tool written in Java. Kohsuke Kawaguchi is the Creator of the Jenkins CI server in 2004, named as Hudson. In 2011 renamed to Jenkins of disputes with Oracle. The tool simplifies the process of integration of changes into the project and delivery of fresh build to users.
1 Continuous Integration (CI)
Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. (or)
Continuous Integration is a development practice where developers integrate their code into a shared remote repository frequently, preferably several times a day. Each Integration is verified by an automating build (Including a test) to detect integration errors as quickly as possible.
1 Immediate bug detection
2 No integration step in the Software Development lifecycle
3 A deployable system at any given point
4 Record of the evolution of the Project
2 Continuous Delivery (CD)
Any and every successful build that has passed all the relevant automated tests and Quality gates can potentially be deployed into production via a fully automated one-click process
3 Continuous Deployment(CD)
The practice of automatically deploying every successful build directly into production without any manual steps knows as Continuous deployment. (or)
It is closely related to Continuous Integration and refers to keeping your application deployable at any point or even automatically releasing to a test or production environment if the latest version passes all automated tests
What Jenkins can do?
1 Integration with many different Version Control Systems (Github, CVS, SVN, TFS …)
2 Generate Test Reports (JUnit)
3 Push the builds to various artifact repositories
4 Deploys directly to production or test environment
5 Notify Stakeholders of build status ( Through Email )
Benefits of Jenkins
1 It’s an open-source tool with great community support.
2 Easy to install and it has a simple configuration through a Web-based GUI, which speeds up the Job
3 It has around 1000+ plugins to ease your work. If a plugin does not exist, Just code it up and share it with the community
4 It was developed on Java and It is manageable on all major platforms
5 Good documentation and enriched support articles/information available on the internet which will help beginners to start easily.
Some popular CI Tools:
Jenkins, Concourse CI, Cloudbees Jenkins, Bamboo, Cruise Control, Travis CI, Circle CI, GitLab CI, Teamcity
1. Install Java Development kit (JDK )
- Download JDK 8 and choose windows 32-bit or 64-bit according to your system configuration. Click on “accept the license agreement.”
2. Set the Path for the Environmental Variable for JDK
- Go to System Properties.move to the “Advanced” tab, select “Environment Variables.”
- Under system variables, select “new”. copy the path of the JDK folder and paste it in the corresponding value field. do for the JRE
- Under system variables, set up a bin folder for JDK in PATH variables.
- Check if Java has been successfully installed
3. Download and Install Jenkins
- Download Jenkins. Under LTS, click on windows.
- After the file is downloaded, unzip it. Click on the folder and install it.
4. Run Jenkins on Localhost 8080
- Jenkins installed open the web browser type “localhost:8080”
- Enter the credentials and log in. If you install Jenkins for the first time, the dashboard will ask you to install the recommended plugins. Install all the recommended plugins.
5. Jenkins Server Interface
- New Item allows you to create a new project.
- Build History shows the status of your builds.
- Manage System deals with the various configurations of the system.
6. Build and Run a Job on Jenkins
- Select a new item (Name – Jenkins_demo). Choose a freestyle project and click Ok.
- Give a description like “This is my first Jenkins job” Under the “Build Triggers” tab select add built step and click on the “Execute Windows” batch command.
- In the command box, type : echo “Hello… This is my first Jenkins Demo: %date%: %time% “. Click on apply and save.
- Select build now. You can see a building history has been created. Click on that. In the console output, you can see the output of the first Jenkins job with time and date.
Freestyle project: This is the central feature of Jenkins. Jenkins will build your project by combining any SCM and any build system. A Free-Style project is a Project that can incorporate almost any type of build. The Free-Style project is the more “generic” form of a project. You can execute shell/docs scripts, invoke ant, and a lot more… majority of the plugins are written to use the Free-Style project.
Maven Project: A Maven Project is a project that will analyze the pom.xml file in greater detail and produce a project that’s geared towards the targets that are invoked. The Maven project is smart enough to incorporate build targets like the JavaDoc or test targets and automatically setup the reports for those targets.
Multi-configuration project: The Multi-configuration project related to matrix project. Let’s run the same build job in Jenkins on many different configurations. This important feature can be beneficial for testing an application in many different environments, including different databases, or even on different build devices.
In conclusion we can say that Jenkins is the most important part for learning DevOps.