A Jenkins build job contains the configuration for automating a specific task or step in the application building process. These tasks include gathering dependencies, compiling, archiving, or transforming code, and testing and deploying code in different environments.
Jenkins supports several types of build jobs, such as freestyle projects, pipelines, multi-configuration projects, folders, multi branch pipelines, and organization folders.
- Linux system with Jenkins configured
- Access to the Web Browser
Follow the steps outlined below to set up and run a new Jenkins freestyle project.
Step 1: Create a New Freestyle Project
1. Click the New Item link on the left-hand side of the Jenkins dashboard.
2. Enter the new project’s name in the Enter an item name field and select the Freestyle project type. Click OK to continue.
3. Under the General tab, if you want you can add a project description in the Description field.
Step 2: Add a Build Step
1. Scroll down to the Build section.
2. Open the Add build step drop-down menu and select Execute shell if you are working on Linux system.
3. Enter the commands you want to execute in the Command field. For this practical, we are using a simple set of commands that display the current version of Java and Jenkins working directory:
4. Click the Save button to save changes to the project.
Step 3: Build the Project
1. Click the Build Now link on the left-hand side of the new project page.
2. Click the link to the latest project build in the Build History section.
3. Click the Console Output link on the left-hand side to display the output for the commands you entered.
4. The console output indicates that Jenkins is successfully executing the commands, displaying the current version of Java and Jenkins working directory.
Congrats ! You have successfully created your first Free style Job in Jenkins. Stay connected for such more articles on DevOps.