Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

The fastest reliable path to a first Jenkins Pipeline is a small Declarative Jenkinsfile with an agent, one named stage, and a steps block containing echo. Create a Pipeline job, run it once, then move the same file into source control so changes can be reviewed and versioned with your application.

What you need before creating a Pipeline

  • Jenkins 2.x or later. Installation details and plugin versions differ, so inspect your controller and Manage Jenkins → Plugins rather than assuming a particular screen.
  • Pipeline support. The suggested plugins in the post-install wizard include the Pipeline plugin. A controller installed differently may have a different plugin set.
  • An executor and agent. Your Pipeline needs an available node/agent on which Jenkins can allocate an executor and workspace.
  • Optional source control. For a disposable test, store the script in the job. For project work, keep a Jenkinsfile in your repository. Git-based jobs require the Git plugin, which is included by default in most installations.

Choose where the Pipeline definition lives

Route How it works Best use Trade-off
Pipeline script You paste Groovy-based Declarative syntax into the job configuration. A quick experiment or learning exercise. The definition is stored in Jenkins, not alongside application code, so repository review and history are unavailable.
Pipeline script from SCM Jenkins checks out a repository and reads the file named in Script Path. Applications and shared team workflows. You must configure the repository, credentials (when needed), SCM type and script path.

For a real project, use the SCM route. Jenkins documentation describes source-controlled Jenkinsfiles as enabling review, iteration, an audit trail and a shared source of truth. The default script path expects a file named Jenkinsfile at the repository root, but you can enter a different relative path.

Create and run a minimal Pipeline in Jenkins

1. Create the job

  1. From the Jenkins dashboard, select New Item.
  2. Enter a project name, select Pipeline, and choose OK.
  3. Scroll to the Pipeline section. Leave Definition as Pipeline script for this first experiment.
  4. Paste the following script into the editor and select Save.
pipeline {
    agent any
    stages {
        stage('Hello') {
            steps {
                echo 'Hello world!'
            }
        }
    }
}

2. Start the first build

Open the job and select Build Now. Open the new build number, then Console Output. A successful run allocates an executor and workspace, enters the Hello stage, prints Hello world!, and finishes successfully. The console is the authoritative place to inspect what Jenkins actually executed.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand every line of the Jenkinsfile

  • pipeline {} encloses a Declarative Pipeline.
  • agent any asks Jenkins to allocate an executor and workspace on any available agent. Without an agent, Jenkins has nowhere to run the steps.
  • stages {} groups work into named stages that appear in Jenkins’ stage-oriented views.
  • stage('Hello') {} gives one unit of work a label. Replace the label with names such as Build, Test or Deploy as your workflow grows.
  • steps {} contains the actions Jenkins executes in that stage.
  • echo writes a message to the build log, giving you an unmistakable first success signal.

Keep this first file intentionally small. Add a build tool, tests or deployment only after the skeleton runs, so a failure has a narrow cause.

Put the Jenkinsfile in Git (recommended for projects)

  1. Create a file named Jenkinsfile at the repository root and commit the minimal Pipeline shown above.
  2. In the Jenkins job, open Configure.
  3. In the Pipeline section, set Definition to Pipeline script from SCM.
  4. Choose Git as the SCM type, enter the repository location and select credentials if the repository is private.
  5. Leave Script Path as Jenkinsfile when the file is at the root. For a subdirectory, enter its repository-relative path, such as ci/Jenkinsfile.
  6. Save the job and select Build Now. Jenkins checks out the configured revision and loads the file from that path.

If Jenkins reports that the file cannot be found, verify the branch or revision, capitalization, repository permissions and script path. A path that works on a case-insensitive local filesystem can still be wrong in a repository.

Declarative versus Scripted Pipeline

Declarative syntax is the practical starting point here: it is simplified and opinionated, which makes the required structure visible to a beginner. Scripted Pipeline is an alternative written in a limited form of Groovy and supports a different, more programmatic style. Both are valid; do not mix examples casually because their syntax and available structure differ.

When you eventually need conditional logic or reusable behavior, first check whether Declarative features meet the requirement. Move to Scripted syntax deliberately, with the team agreeing on the style it will maintain.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Generate plugin-specific steps instead of guessing

Open ${YOUR_JENKINS_URL}/pipeline-syntax on your controller. Jenkins’ built-in Snippet Generator is populated from steps exposed by plugins installed on that controller, so its output reflects your actual environment rather than a generic example. The same area documents a Declarative Directive Generator and Global Variable Reference.

This matters because a step shown in an article may be unavailable, renamed or configured differently on your controller. Select the installed step in the generator, fill in its fields, generate the snippet and place it in the appropriate steps block. Treat generated code as a starting point and review secrets and paths before committing it.

Useful next structure after “Hello world!”

Once the first build is green, expand by adding stages while preserving the same top-level shape:

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                echo 'Build command goes here'
            }
        }
        stage('Test') {
            steps {
                echo 'Test command goes here'
            }
        }
    }
}

Replace the messages with commands appropriate to the tools installed on the selected agent. If a command is not available there, the Pipeline will fail even though the Jenkinsfile is syntactically valid; install the tool on the agent or select an agent that provides it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot the first run

“No such DSL method” or an unknown step

The step may come from a plugin that is not installed, or the name may be wrong. Check Manage Jenkins → Plugins, then use the controller’s Pipeline Syntax page to generate a step supported by your installation.

The build waits indefinitely

agent any still requires an online agent with an available executor. Inspect node and executor status, labels and workspace availability before changing the Jenkinsfile.

The job says the Jenkinsfile is missing

Confirm that Definition is Pipeline script from SCM, the repository and revision are correct, and Script Path matches the committed, case-sensitive path.

Git checkout fails

Verify the repository URL, selected credentials, network access from the controller or agent and the Git plugin installation. A successful local clone does not prove that Jenkins has the same credentials or network route.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The script is rejected before any stage runs

Check braces, quotes and Declarative structure. The top level must contain agent and stages, and executable actions belong inside a stage’s steps. Start from the known-good minimal file and add one change at a time.

The build runs but produces no useful evidence

Add explicit log messages around each operation and inspect Console Output. For a first diagnostic run, keep the echo step so you can distinguish scheduling problems from command failures.

Viewing Pipeline progress today

Do not make Blue Ocean the primary setup route: Jenkins documentation says it has been deprecated since July 2026 and will receive no further security fixes or functionality updates. Use the standard Jenkins job and build pages. For graphical stage visualization, the actively maintained Pipeline Graph View plugin is identified by Jenkins as an option; Pipeline: Stage View is another alternative. Availability depends on what your controller has installed.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a clean image or PDF of a Jenkins page for a runbook, ticket or report, ScreenshotNeo can capture it with one request. Its API accepts a URL and returns PNG, JPEG, WebP or PDF; consent banners are accepted and removed before capture, along with more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. An MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

See the ScreenshotNeo API documentation for all options. For example:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://jenkins.example.com/job/demo/1/console -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://jenkins.example.com/job/demo/1/console"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://jenkins.example.com/job/demo/1/console' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Every feature is on every plan: full-page and element capture, device and viewport settings, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agent, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data and an OpenAPI specification. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

First-Pipeline checklist

  • Jenkins 2.x or later is running and you inspected the installed plugins.
  • A Pipeline job exists and has an available agent/executor.
  • The Declarative file contains agent, stages, a stage and steps.
  • The first build prints Hello world! in Console Output.
  • Project code uses Pipeline script from SCM with a verified repository and Script Path.
  • Plugin-specific steps came from your controller’s Pipeline Syntax generator.
  • You are using standard Jenkins views or a maintained visualization plugin rather than starting a new Blue Ocean workflow.

Frequently Asked Questions

Can I rename the Jenkinsfile?

Yes. Keep the file at the repository root with the default name, or enter its repository-relative location in the job’s Script Path field.

Does a Jenkinsfile have to use Declarative syntax?

No. Jenkins supports both Declarative and Scripted Pipeline; Declarative is the simpler starting syntax used in this guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where can I see why a Pipeline failed?

Open the specific build and select Console Output; it shows scheduling, checkout, stage and command messages produced during that run.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.