Practice Exercise 2: Working with Different Projects
Objectives
-
Familiarize with the different types of Jenkins projects
-
Demonstrate how to integrate Jenkins with GitHub as a version control system.
-
By the end of this exercise, you should be able to create and configure Jenkins projects for different purposes and integrate them with a GitHub repository.
Prerequisites
-
Jenkins installed and running.
-
A GitHub account.
-
Access your lab instance by following the instructions in accessing your Lab Environment.
Access Jenkins
-
Get the ip address of your lab instance.
-
Open your web browser and navigate to http://your_lab_ip:8080.
-
Your login name is the letter of your first name (second name not included) and your lastname (i.e. Mark Jimmy Santos = msantos). Password is the same as the password provided by your instructor.
Duration: 60 minutes
Tasks
Important Notes
:
-
Always take note of the build/project url.
-
Use this form to input the build/project on each task.
Part 1: Jenkins Project Types
In this part of the exercise, you will explore different types of Jenkins projects.
Freestyle Project:
-
Create a new Freestyle Project in Jenkins.
-
Configure it to build a simple "Hello World" application. Use a shell script or batch command to echo "Hello, World!".
-
Provide the url of the freestyle job.
Multi-Project Job:
-
Create a new Multi-Project in Jenkins.
-
Configure it to build a simple "Hello World" application. Use a shell script or batch command to echo "Hello, World!".
-
Provide the url of the Multi-Project job.
Part 2: GitHub Integration
In this part of the exercise, you will integrate Jenkins with GitHub as a version control system.
GitHub Setup:
-
Create a new public GitHub repository (or use an existing one) to host your code.
-
Push the "Hello World" application code to the GitHub repository.
Jenkins-GitHub Integration:
-
Install and configure the GitHub plugin in Jenkins.
-
Create a new Jenkins job (Freestyle or Pipeline) and set up the integration with your GitHub repository. Use "GitHub project" to specify the GitHub repository URL.
-
Configure a webhook in the GitHub repository settings to trigger the Jenkins build on code changes.
Testing the Integration:
- Make a change to the code in your GitHub repository and commit the changes.
- Observe how Jenkins automatically triggers a build when changes are pushed to the repository.
-
Verify that the "Hello, World!" application is built successfully.
Note: Provide the project url in form provided.
Conclusion
In this lab exercise, you learned how deal with different Jenkins project types. You are able to explore the freestyle and multi-project job. In addition, you are able to experience configuring your github integrated with Jenkins.