top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Configure freestyle project with Jenkins

In this tutorial, we will define what a Jenkins Freestyle Project is and show you how to set one up.


What is Jenkins — Jenkins is an open-source server used for automating software development and deployment. It allows developers to create repeatable jobs that contain all the code necessary to build an application.


Working with projects — Jenkins uses projects (also known as “jobs”) to perform its work. Projects are defined and run by Jenkins users. Jenkins offers several different types of projects, including:

  • Freestyle project

  • Maven project

  • Pipeline

  • Multi-configuration project

  • Folder

  • Multibranch Pipeline

  • Organization folders


What is a Jenkins Freestyle Project?

Jenkins freestyle projects allow users to automate simple jobs, such as running tests, creating and packaging applications, producing reports, or executing commands. Freestyle projects are repeatable and contain both build steps and post-build actions.

There are limitations in the types of actions you can perform in a build step or post-build action. Within a Jenkins freestyle project, there are several standard plugins available to help you overcome this problem. These plugins allow you to configure build triggers and offer project-based security for the Jenkins project.


To create a Jenkins freestyle job — You need to have Java 8 or 11 before you start. To set up freestyle projects using Jenkins, we need to ensure that we have Jenkins installed and up and running. log on to your Jenkins dashboard by visiting your Jenkins installation path.

Usually, it will be hosted on localhost at http://localhost:8080 If you have installed Jenkins in another path, use the appropriate URL to access your dashboard as shown in the below Jenkins job creation example.



Prerequisite -

Step 1. Installed the plugins based on the needs of your project and how you like to configure Jenkins. At a minimum, you will need Cucumber, Allure, Git/GitHub plugins.


To install the plugins, go to → Manage Jenkins → Plugins → Available Plugins. Then, under Upload Plugin, select the plugin to upload. Restart the Jenkins server. Verify the installed plugins on the Installed tab.


Step 2. Next, you need to setup credentials under Tools. To setup, go to → Manage Jenkins → Tools → Add Credentials. The main components are JDK Installations, Git Installations, Gradle/Ant/Maven Installations (In this tutorial, I have used Maven) and Allure Commandline Installations. Under each installations, provide the path to the home directory where these tools are installed on your dev environment.


How to create a new build job in Jenkins -


  1. The first step is to create a Jenkins build job. Click the ‘New Item’ link in the top left-hand corner of the admin console. Below is a screenshot of how it will look like:

2. In the second step, enter the name of the item you want to create. We can use the "Project_Name" for this demo. Select 'Freestyle project' and Click 'Ok'.

When we click Ok, Jenkins automatically takes us to the project configuration view, where we need to configure our project details.


3. Enter Project details


4. Enter repository URL under 'Source Code Management', Select Git as a repository source and enter your Git Repository URL. Additionally, enter the branch name to build under 'Branches to build'.

You may also use a local repository on your dev. If your GitHub repository is private, Jenkins will validate your login credentials with GitHub before pulling the source code from your GitHub repository.


5. Add pre build under the Root Pom and Goals and options — see in the below screenshot


6. Add post build actions -Click on the Add build post actions tab, as per your need select from the drop-down, for example shown in below screenshot. For my project, I used Allure Report, Publish HTML Reports and Cucumber Reports.



7. When you have successfully entered all the information on the configure page, click on save button. This will commit your changes and take you back to the Jenkins admin console. If you click Apply, it will commit your changes but will keep you on your Jenkins build job configuration page.


8. Click on the Build Now option. When the build runs, a new entry will appear in the build history box identified with the number one. Click on the drop-down box next to the number to view the console output. You will see the results of running the java -version command, as well as the directory listing command.


9. Click on the build number and then Click on console output to see the status of the build you run. In the console output, you should see the output from the build and Finished: SUCCESS.


Summary

  • Jenkins Freestyle Project is an improved job or task that can span multiple operations.

  • The types of actions you can perform in a 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.

  • Freestyle build Jenkins jobs are highly flexible and easy-to-use. You can use it for any type of project; it is easy to set up, and many of its options appear in other build Jenkins jobs.

  • 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.

  • This tutorial is base on Jenkins 2.426.1 version.


59 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page