DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Mastering Shift-Left: The Ultimate Guide to Input Validation in Jenkins Pipelines
  • Jenkins Pipelines With Centralized Error Codes and Fail-Fast
  • Optimizing CI/CD Pipeline With Kubernetes, Jenkins, Docker, and Feature Flags
  • Building Jenkins Infrastructure Pipelines

Trending

  • Don't Adopt Anything Announced at re:Invent for 90 Days
  • Modernizing a Legacy Java Application With OpenRewrite: What We Automated and What We Didn't
  • Idempotent Consumers: Preventing Stale Retries With Version-Fenced Writes
  • Spring AI on Local LLMs

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Testing, Deployment, and Maintenance
  3. DevOps and CI/CD
  4. Tips to Debug Jenkins v2.x Pipeline Script(s), Part 1

Tips to Debug Jenkins v2.x Pipeline Script(s), Part 1

Check out this simple explanation of these three features that will help you with your Jenkins pipeline.

By 
Ramanathan M
·
Jan. 03, 19 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
34.4K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

Introduction

In this series of posts, I wish to share (and learn from their feedback) with the community, some of the ways and methods to debug Groovy-DSL scripts used in Jenkins v2.x Pipeline-as-code.

Replay

This feature enables iterative development of the pipeline script. For beginners, it's a great feature as they can try out various possibilities before submitting the working version of the script for peer code review.

Select the build job from the Jenkins project that you wish to replay. devtest-pipeline is the project in this screenshot and we can choose to click the Replay option available for job #362.

Replay


"Show Me Red," a.k.a. Fix the Syntax Errors

On selecting the Replay option, Jenkins opens up a simple in-line editor as shown below.

This screenshot shows the pipeline-as-code script with line 7 marked by a white colored "X" inside the red square box. Such error pointer(s) (it's my lingua franca) are enabled by the Jenkins Pipeline's suite of plugins. For the sake of this example, I induced the error pointer, by removing the closing double quote at the end of the println  statement.

Error pointer

This provision (error pointer) is quite handy when you are in the process of writing such pipeline-as-code Groovy-DSL scripts — either scripted or declarative.

Easy on The Eyes

This is not a technical one but will help to avoid silly mistakes, like, missing quote(s) or typo errors.

With the Replay option making available a simple editor, the default size of that editor can be quite small and compact. However, there is no lock-in with regard to the real estate of the editor, hovering the mouse cursor on the extreme right-hand side bottom of the editor brings up (single or double headed) an arrow that helps you to resize the shape of the editor.

Resize the editor


Jenkins (software) Pipeline (software) Debug (command)

Opinions expressed by DZone contributors are their own.

Related

  • Mastering Shift-Left: The Ultimate Guide to Input Validation in Jenkins Pipelines
  • Jenkins Pipelines With Centralized Error Codes and Fail-Fast
  • Optimizing CI/CD Pipeline With Kubernetes, Jenkins, Docker, and Feature Flags
  • Building Jenkins Infrastructure Pipelines

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook