October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

Jenkins Pipeline Tutorial: How to Create and Run a Pipeline

A practical first-run guide to Jenkins Pipeline: prerequisites, a minimal Declarative example, Jenkinsfile and UI setup, agent and syntax choices, and common fixes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To create and run a Jenkins Pipeline, define a Pipeline in a Jenkinsfile or in a Jenkins Pipeline job, save it, then start a build and inspect its stage results and console output. For a first run, use Declarative syntax with a single echo step; it verifies the Pipeline setup without depending on a build tool installed on your agent.

What you need before creating a Pipeline

Jenkins Pipeline is a suite of plugins for defining and integrating continuous-delivery workflows. Jenkins’ getting-started documentation lists Jenkins 2.x or later and the Pipeline plugin as prerequisites; the suggested plugins in the post-installation setup wizard include Pipeline.

  • A Jenkins controller where you can create or configure jobs.
  • The Pipeline plugin installed.
  • An available agent to execute the Pipeline if it uses an agent. An agent is a machine or execution node Jenkins assigns work to.
  • For the source-control route, a project repository that Jenkins can access.

You can define a Pipeline in the classic Jenkins UI or store it as a Jenkinsfile in your repository. The syntax is the same in either case. For an evolving project, the repository approach makes the Pipeline definition versioned and reviewable alongside the project code. Jenkins’ “Creating your first Pipeline” documentation describes a Jenkinsfile checked into source control as the typical way to define a Pipeline.

Start with a minimal Declarative Pipeline

This complete example prints a message and does not require a compiler, test runner, or other project-specific software:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
pipeline {
    agent any
    stages {
        stage('Hello') {
            steps {
                echo 'Hello from Jenkins Pipeline'
            }
        }
    }
}

In Declarative syntax, the outer pipeline block contains the definition. agent any asks Jenkins to allocate an available execution agent and workspace. The stages block groups work; each stage has a readable name, and its steps block contains the actions Jenkins runs. Here, echo writes a message to the build’s console output.

A Declarative Pipeline needs a top-level pipeline block, an agent declaration, and stages containing steps. This example is intentionally only a first-run check; replace the message with commands appropriate to your project after confirming it runs.

Create and run a Pipeline from a Jenkinsfile

  1. At the root of your project repository, create a file named exactly Jenkinsfile (no file extension).
  2. Paste in the minimal example above, or adapt it for your project.
  3. Commit and push the file to the branch Jenkins should build.
  4. In Jenkins, create or configure a Pipeline job to load its Pipeline definition from source control. Select the repository and branch containing the Jenkinsfile; exact screen labels vary with Jenkins version and installed plugins.
  5. Save the job configuration and start a build. In the job page, use the available build action (often labelled Build Now) or the configured trigger.
  6. Open the build and inspect its stage view and console output. The Hello stage should complete and the console should contain Hello from Jenkins Pipeline.

Jenkins’ Pipeline as Code guidance describes putting the Jenkinsfile in the repository root so Jenkins can discover and manage Pipeline jobs for repositories and branches.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Create and run a Pipeline in the classic UI

  1. From the Jenkins Dashboard, select New Item.
  2. Enter a job name and choose a Pipeline job type.
  3. In the job configuration’s Pipeline section, enter the minimal Declarative script in the Pipeline script field.
  4. Save the job, then start a build using the available build action, commonly Build Now.
  5. Open the build’s stage view or console output to check the result.

A script entered directly in the UI is stored in Jenkins’ home directory rather than in your project repository. That can be convenient for trying the first run, but the source-controlled Jenkinsfile route is easier to review and keep in step with code changes.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Turn the first run into project work

Once the message-only example succeeds, add commands and stages that actually exist in your build environment. The Jenkins deployment tutorial uses Build, Test, and Deploy as a basic continuous-delivery sequence. Treat that as an illustrative pattern, not a mandate: a project that does not deploy from Jenkins may need only build and test stages.

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh 'make'
            }
        }
        stage('Test') {
            steps {
                // Replace with the test command for your project.
                sh './run-tests'
            }
        }
    }
}

This illustrates the structure, not universal commands: use make only if it is installed and appropriate for the project, and replace ./run-tests with a real test command. Jenkins’ sh step runs Unix/Linux shell commands. On a Windows agent, use bat for Windows batch commands. A nonzero command exit code fails the Pipeline, which normally prevents later stages from running successfully.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

For test reporting, Jenkins’ Jenkinsfile guidance demonstrates the junit step. It also documents archiveArtifacts for basic artifact retention; archiving in Jenkins is not a substitute for an external artifact repository when your delivery process requires one.

Choose syntax and agent placement

Declarative or Scripted

Declarative syntax gives a Pipeline a structured, opinionated form that is a readable starting point for straightforward workflows. Scripted Pipeline uses a limited form of Groovy and supports constructs such as conditionals, loops, and exception handling. Start with Declarative unless the workflow needs that additional flexibility; the two styles should not be confused as different job types.

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

One agent for the Pipeline or agents per stage

agent any at the top level runs the Pipeline on an available agent. You can use a label instead when the job needs a particular configured agent. A top-level agent none avoids reserving one agent for the whole Pipeline, but then each stage must declare its own agent. This is useful when stages need different configured environments; it also means you must ensure each requested agent is available.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Common first-run problems and fixes

  • Jenkins rejects the Pipeline syntax: check that the Pipeline plugin is installed and that the Declarative structure is complete, including the top-level pipeline, agent, stages, stage, and steps blocks.
  • The job cannot find the Jenkinsfile: confirm the file is named Jenkinsfile, is at the repository root, and exists on the branch configured for the job. Check that Jenkins can access the repository.
  • The build waits for an agent: agent any still requires an available agent. Check that an agent is online and that any label used by the Pipeline matches a configured agent.
  • A shell command fails immediately: verify the command exists on that agent, runs from the expected workspace, and is valid for its operating system. Use sh on Unix/Linux agents and bat for Windows batch commands.
  • A later stage does not run: inspect the earlier stage’s console output. A failed command, including one returning a nonzero exit code, can fail the Pipeline before subsequent work completes.
  • The test stage runs but reports are missing: configure the project to produce test result files and use Jenkins’ junit step with the appropriate report location.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep credentials and inputs safe

Jenkins’ Pipeline guidance documents credential helpers and warns that interpolating user-controlled values into a shell step can permit arbitrary code execution. Do not print secrets to the console, and do not interpolate untrusted input into shell commands. Use Jenkins credential mechanisms for secrets and validate or safely pass inputs rather than composing executable shell text from them.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server, not a Jenkins runner; use Jenkins itself to create and execute the Pipeline above. If you need a screenshot of a rendered web page, ScreenshotNeo can capture it with one GET request. Its clean-shot processing accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf.

For example, this cURL command saves a screenshot of Stripe’s website as WebP; replace the target URL with the page you want to capture. See the ScreenshotNeo API documentation for request options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The Free plan includes 1,000 shots per month with no card required; paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo, then sign up for 1,000 free screenshots a month with no card.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Frequently Asked Questions

Can I keep the Pipeline script in Jenkins and also use a Jenkinsfile?

Yes. Jenkins supports a script entered in a Pipeline job’s configuration as well as a Jenkinsfile loaded from source control; choose one definition source for a given job to avoid maintaining competing versions.

Does a Jenkins Pipeline have to include a Deploy stage?

No. Build, Test, and Deploy is an illustrative continuous-delivery sequence; include only the stages your project’s process needs.

Where do I see why a Pipeline failed?

Open the specific build’s console output and inspect the stage where execution stopped; it shows command output and the reported failure.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.