Freestyle Jobs

A freestyle job is the classic, form-based way to configure a build using clicks instead of code.

A freestyle project is the simplest kind of Jenkins job. You configure it entirely through web forms — no code required — which makes it great for learning the concepts.

Creating one

  1. Click New Item on the dashboard.
  2. Enter a name and choose Freestyle project.
  3. Configure source code, triggers, and build steps on the config page.

What you can configure

  • Source Code Management — point it at a Git repository.
  • Build Triggers — decide when it runs.
  • Build Steps — the commands to execute.
  • Post-build Actions — archive files, send notifications, etc.

Example

Example · bash
# A freestyle job's 'Execute shell' build step is just a script.
# Example contents of that box:

echo "Starting build..."
npm install
npm test
echo "Build finished with status $?"

When to use it

  • A QA team creates a freestyle job to run a shell script that starts their Selenium test suite against a fixed URL.
  • A sysadmin uses a freestyle job to invoke an Ansible playbook without writing any pipeline code.
  • A beginner configures their first Jenkins job as a freestyle project to learn job anatomy before moving to pipelines.

More examples

Shell build step in freestyle job

A basic shell build step that installs dependencies and runs tests inside a freestyle job.

Example · bash
#!/bin/bash
# Executed as the 'Execute shell' build step
set -e
echo "Building on $NODE_NAME"
npm install
npm test

Maven build step invocation

Mirrors the Maven build step configuration in a freestyle project using the Maven plugin.

Example · bash
# In the freestyle job, under Build Steps:
# 'Invoke top-level Maven targets'
#   Maven Version: Maven-3.9
#   Goals: clean package -DskipTests=false
mvn clean package -DskipTests=false

Archive output in freestyle job

Combines a Maven build step with the Archive Artifacts post-build action in a freestyle job.

Example · bash
# Build step: Execute shell
mvn package

# Post-build action: Archive the artifacts
# Files to archive: target/*.jar
# Fingerprint: checked
echo "JAR archived from target/"

Discussion

  • Be the first to comment on this lesson.