Published: 2026-06-01 โ€ข Updated: 2026-06-17

Creating Your First Jenkins Freestyle Job

Welcome to the fourth installment of our comprehensive CI/CD bootcamp. In our previous topic, understanding-jenkins-architecture, we explored how Jenkins coordinates tasks. Now, it is time to get hands-on. In this guide, you will learn how to create, configure, and run your very first Jenkins Freestyle job from scratch.

What is a Jenkins Freestyle Job?

A Jenkins Freestyle job is a highly flexible, easy-to-use option for orchestrating simple build, test, and deployment tasks. It provides a user-friendly, web-based interface where you can configure build steps, triggers, and post-build actions without writing complex pipeline scripts. It is the perfect starting point for beginners to understand how Jenkins interacts with the operating system, source control, and build tools.

The Lifecycle of a Freestyle Job

Before we build, let us visualize the lifecycle of a typical Jenkins Freestyle job. It flows sequentially through several distinct phases:

+--------------------------------------------------+
|                  1. Trigger                      |
|  (Manual, Git Commit, Cron Schedule, Webhook)    |
+--------------------------------------------------+
                        |
                        v
+--------------------------------------------------+
|         2. Source Code Management (SCM)         |
|         (Clones code from Git/GitHub)            |
+--------------------------------------------------+
                        |
                        v
+--------------------------------------------------+
|                 3. Build Steps                   |
|   (Runs Shell Scripts, Maven, Gradle, etc.)      |
+--------------------------------------------------+
                        |
                        v
+--------------------------------------------------+
|              4. Post-Build Actions               |
|  (Sends emails, archives artifacts, triggers)    |
+--------------------------------------------------+

Step-by-Step Guide: Creating Your First Freestyle Job

Follow these steps to create a basic job that executes a shell command and outputs a custom message to the console.

Step 1: Create a New Item

Log in to your Jenkins dashboard. On the left-hand sidebar, click on New Item. This will open the job creation page. Enter a unique, descriptive name for your job, such as My-First-Freestyle-Job. Select Freestyle project from the list and click OK at the bottom of the page.

Step 2: General Configuration

Once the job is created, you will be redirected to the configuration page. In the General section, you can add a description. It is a best practice to write a clear description so other team members understand the job's purpose. For example: This is a beginner demo job to print system information and verify Jenkins environment setup.

Step 3: Source Code Management (SCM)

For this introductory tutorial, we will select None for Source Code Management. In later modules, such as integrating-jenkins-with-github, we will configure this to pull code directly from a repository.

Step 4: Build Triggers

Build Triggers define when your job should run. For now, leave all options unchecked. This means the job will only run when you manually trigger it by clicking the "Build Now" button on the dashboard.

Step 5: Define Build Steps

This is where the actual work happens. Scroll down to the Build Steps section. Click on the Add build step dropdown menu. Depending on your operating system, select one of the following:

  • If Jenkins is running on Linux or macOS, select Execute shell.
  • If Jenkins is running on Windows, select Execute Windows batch command.

In the text area that appears, enter the following commands to display system information and simulate a build process:

echo "=== Starting Build Process ==="
echo "Current Date and Time:"
date
echo "Current User running this job:"
whoami
echo "Workspace Directory:"
pwd
echo "=== Build Completed Successfully ==="

Step 6: Post-build Actions

Post-build actions are executed after the build steps finish, regardless of whether the build succeeded or failed. You can use this section to archive build artifacts, send email notifications, or trigger other downstream jobs. For this first exercise, we will leave this blank. Click Save at the bottom of the screen to apply your settings.

Running Your Jenkins Job

Now that your job is configured, you will be redirected to the job's main dashboard page. To execute the job, click on Build Now on the left-hand menu.

You will see a new build appear under the Build History section on the bottom left, labeled with a build number like #1. A green checkmark or a blue/green ball indicates success, while a red ball indicates failure.

Viewing the Console Output

To see what your script did, click on the build number (e.g., #1) and select Console Output. You should see output similar to this:

Started by user admin
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/My-First-Freestyle-Job
[My-First-Freestyle-Job] $ /bin/sh -xe /tmp/jenkins123456789.sh
+ echo === Starting Build Process ===
=== Starting Build Process ===
+ echo Current Date and Time:
Current Date and Time:
+ date
Mon Oct 23 14:30:00 UTC 2023
+ echo Current User running this job:
Current User running this job:
+ whoami
jenkins
+ echo Workspace Directory:
Workspace Directory:
+ pwd
/var/jenkins_home/workspace/My-First-Freestyle-Job
+ echo === Build Completed Successfully ===
=== Build Completed Successfully ===
Finished: SUCCESS

Real-World Use Cases for Freestyle Jobs

While modern CI/CD practices favor Jenkins Pipelines, Freestyle jobs remain highly useful for specific scenarios:

About the Author

Naresh Kumar

Naresh Kumar

Senior Java Backend Engineer experienced in Banking, Payments, ISO 20022, Spring Boot, Microservices, Kafka, Docker, Kubernetes, AWS and Cloud Native Systems.

Built enterprise payment solutions, transaction processing systems, API platforms and scalable microservices used in production.

LinkedIn Profile