How to Create a New Build Job in Jenkins Freestyle Project
Today, We will know how to create a new build job in Jenkins. Read: How to Create/Add Users in Jenkins and Manage Permissions
What is a Jenkins Freestyle Project?
Jenkins Freestyle Project is a repeatable build job, script, or pipeline that contains steps and post-build actions. It is an improved job or task that can span multiple operations. It allows you to configure build triggers and offers project-based security for your Jenkins project. It also offers plugins to help you build steps and post-build actions.
The types of actions you can perform in a Jenkins build step or post-build action are quite limited. There are many standard plugins available within a Jenkins Freestyle Project to help you overcome this problem.
Read: How to Integrate Jenkins With GitHub
How to Create a New Build Job in Jenkins
The freestyle build job is a highly flexible and easy-to-use option. You can use it for any type of project; it is easy to set up, and many of its options appear in other build jobs. Below is a step-by-step process to create a job in Jenkin.
Step 1) login to Jenkins
Step 2) Create New Item
Click on “New Item” at the top left-hand side of your dashboard.
Step 3) Enter Item details
In the next screen,
- Enter the name of the item you want to create. We shall use the “Hello world” for this demo.
- Select Freestyle project
- Click Okay
Step 4) Enter Project details
Enter the details of the project you want to test.
Step 5) Enter repository URL
Under Source Code Management, Enter your repository URL.
It is also possible for you to use a local repository.
If your GitHub repository is private, Jenkins will first validate your login credentials with GitHub and only then pull the source code from your GitHub repository.
Step 6) Tweak the settings
Now that you have provided all the details, it’s time to build the code. Tweak the settings under the build section to build the code at the time you want. You can even schedule the build to happen periodically, at set times.
Under build,
1. Click on “Add build step”
2. Click on “Execute Windows batch command” and add the commands you want to execute during the build process.
Step 7) Save the project
When you have entered all the data,
- Click Apply
- Save the project.
Step 8) Build Source code
Now, in the main screen, click the Build Now button on the left-hand side to build the source code.
Step 9) Check the status
After clicking on Build now, you can see the status of the build you run under Build History.
Step 10) See the console output
Click on the build number and then Click on console output to see the status of the build you run. It should show you a success message.
Pingback: Jenkins Pipeline: How to Create JenkinsFile - Eduguru