Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A Quiz
🔐 Introduction
With Jenkins installed and configured, it’s time to take
your first hands-on step into automation — by creating your very first Jenkins
job. A Jenkins job is essentially a task or project that Jenkins
will execute for you automatically. Whether it's building code, running tests,
or deploying an application, a job is the core unit of execution in Jenkins.
This chapter walks you through the complete process of
creating a Jenkins job, step-by-step. You’ll learn how to create freestyle
jobs, connect to version control, add build steps, trigger actions, and view
output — all with real-world examples and screenshots in mind.
🧠 What is a Jenkins Job?
A Jenkins job (or project) is a runnable task that
can be configured to:
🧱 Types of Jenkins Jobs
Job Type |
Description |
Freestyle Project |
GUI-based configuration
for simple builds |
Pipeline |
Scripted or
declarative Groovy pipelines for advanced automation |
Multibranch
Pipeline |
Automatically builds
branches and PRs from repositories |
Maven Project |
Simplifies
Java builds using Maven |
External Job |
Monitor tasks outside
Jenkins (used with cron, shell scripts, etc.) |
In this chapter, we focus on the Freestyle Project,
which is ideal for beginners.
🛠️ Step-by-Step: Create
Your First Jenkins Job
✅ Step 1: Log In to Jenkins
✅ Step 2: Create a New Freestyle
Job
You’ll be redirected to the job configuration screen.
✅ Step 3: Configure Source Code
Management (Git)
If you want to automate a project from GitHub:
✅ Step 4: Add a Build Step
bash
echo
"Hello Jenkins!"
You can also run:
bash
python3
myscript.py
npm
install && npm run build
mvn
clean package
✅ Step 5: Set Triggers (Optional)
To automate job execution:
Trigger Type |
Description |
Poll SCM |
Checks Git repo
periodically (cron format) |
Build periodically |
Runs job at
intervals (cron format) |
GitHub webhook |
Builds when code is
pushed (via webhook) |
Trigger from another project |
Builds this
job when another job finishes |
Example for Poll SCM (every 15 mins):
bash
H/15
* * * *
✅ Step 6: Post-build Actions
(Optional)
✅ Step 7: Save and Run the Job
✅ Step 8: View Console Output
pgsql
Started by user admin
Running as SYSTEM
Building in workspace
/var/jenkins_home/workspace/HelloWorld-Build
Hello Jenkins!
Finished: SUCCESS
Congratulations, you've created and run your first Jenkins
job!
🧩 Understanding Jenkins
Job Components
Section |
Purpose |
General |
Set job name,
description, and concurrency settings |
Source Code Management |
Connects to
Git, Subversion, or Mercurial repositories |
Build Triggers |
Defines when to run
the job (cron, webhook, etc.) |
Build Environment |
Pre-build
scripts, cleanups, environment variables |
Build Steps |
Commands/scripts to
compile, test, or run code |
Post-build Actions |
Actions like
notifications, archiving, downstream triggers |
🧪 Sample Use Cases for
Freestyle Jobs
Use Case |
How Jenkins Helps |
Compile a Java app |
Use Maven or Gradle
and archive .jar files |
Run tests for a Python app |
Use pytest or
unittest in shell commands |
Pull and run a
Node.js app |
Use npm install
&& npm test |
Deploy static files to FTP |
Use shell
script and FTP plugin |
Backup a database
nightly |
Schedule backup script
via CRON-style triggers |
🔄 What Happens Behind the
Scenes
When you run a job, Jenkins:
You can see all of this in the console output or the Workspace
directory.
📘 Summary
Creating your first Jenkins job is like building your first
robot — simple at first, but packed with potential. With Freestyle projects,
you can quickly prototype automation tasks, build test scripts, or deploy apps.
As you grow, you can evolve these jobs into powerful pipelines.
Jenkins jobs are the stepping stones to full CI/CD pipelines
— learn the basics, then scale the automation.
Jenkins is an open-source automation server that helps developers automate building, testing, and deploying code. It enables Continuous Integration and Continuous Delivery (CI/CD), making software delivery faster and more reliable.
To install Jenkins, you need:
The simplest way is to use the Jenkins WAR file:
java -jar jenkins.war
Alternatively, you can use a Docker container for a quick and clean setup:
docker
run -p 8080:8080 jenkins/jenkins:lts
Install the Git and GitHub plugins, then:
A pipeline is a script-based workflow written in Groovy DSL that defines your automation steps (e.g., build, test, deploy). Pipelines can be declarative (simplified) or scripted (flexible).
For basic automation, start with:
Yes! Jenkins integrates with Docker for building images and with Kubernetes for scaling jobs using agents. Tools like Jenkins X also help automate deployments in Kubernetes.
You can:
Yes! Jenkins is 100% free and open-source, licensed under MIT. You can use it in personal, educational, and commercial environments without restriction.
Please log in to access this content. You will be redirected to the login page shortly.
LoginReady to take your education and career to the next level? Register today and join our growing community of learners and professionals.
Comments(0)