How to Debug Pipeline

When any of our Jenkins pipelines got red, how to find which step failed the pipeline?

Code structure: RackHD Jenkins pipeline coding convention

Step-by-step guide

  1. Open the pipeline view and click the red circle: 
    If the pipeline view failed to show up or failed to find any error message, goes to step 2

  2. Go back to the classic page (click the button:  at the upper right corner)  and open the full console log.
  3. Find some key words to find which step failed the pipeline.
    Find below Key words:

    Key WordsMeaningMarkcode
    failed in branchIt tells us which stage of pipeline is failed. For example:
    [manifest FIT] Failed in branch manifest FIT


    stage name Such as:
    [manifest FIT]
    Find the last several lines of the stage. For example:
    [Pipeline] [manifest FIT] // lock
    [Pipeline] [manifest FIT] }


    Trying to acquire lock onIt tells us there is a stage trying to request lock resource.
    [on-http] Trying to acquire lock on [Label: unittest, Quantity: 1]

    lock(label:label_name,quantity:1){ ... } or lock("resource name"){ ... }
    Lock acquired on
    It tells us the stage succeeds to get the lock resource.
    [on-http] Lock acquired on [Label: unittest, Quantity: 1]

    Lock released on resource
    it tells us the stage released the lock resource.
    [on-http] Lock released on resource [Label: unittest, Quantity: 1]

    Running onit tells us the stage is running on the slave and the workspace.
    Running on vmslave01 in /home/jenkins/workspace/on-http@3
    node(){ ... } "node" does 2 things: 1. allocate a free executor of the node 2. create workspace for steps within the node block.
    Timeout set to expire in
    It tells us the step is set to timeout for xx mins
    [Pipeline] [on-core] timeout
    [on-core] Timeout set to expire in 15 min
    [Pipeline] [on-core] {


    If not timeout:

    [Pipeline] [on-core] // timeout
    else:
    [on-core] Cancelling nested steps due to timeout
    timeout(15){ ... }
    ...



 

RackHD Jenkins pipeline coding convention