2
votes

I am pretty new to Jenkins and its plugins. I managed to setup a declarative pipeline job on my Jenkins server. The pipeline stage view is a bit strange.

  1. There is a gap between the first stage and the left-hand side panel.

  2. There are extra stages as Declarative Checkout SCM, Declarative Agent Setup and Declarative Post Actions being displayed, which are not part of my Jenkinsfile. Can I hide these stages and only show stages in my Jenkinsfile?

Here is the version info of my configuration:

pipeline-stage-view                Pipeline: Stage View Plugin       2.10
pipeline-stage-step                Pipeline: Stage Step              2.3
pipeline-stage-tags-metadata       Pipeline: Stage Tags Metadata     1.3.7
simple-theme                                                         0.5.1
jenkins version 2.164.1

I also use the neo2 theme via the simple-theme plugin

enter image description here

Update 1 Disabling the simple-theme plugin made NO difference

1
Those extra stages do not execute or display by default. Could you share what you have done outside of normal pipeline setup?Matt Schuchard

1 Answers

1
votes

I figured out the source of these extra steps and how to get rid of them by change your Jenkinsfile.

Originally my Jenkinsfile looks like

  pipeline {
    agent { dockerfile true } // causes the "Declarative Agent Setup" stage

    options {
        ansiColor('xterm')
    }

    stages {
       ...
    }
    post { // causes the "Declarative Post Actions" stage
       ...
    }
}

The Declarative Checkout SCM is the default behaviour when you configure your pipeline to use Pipeline script from SCM.

After I updated my Jenkins file to

  pipeline {
    agent { label 'docker' } // Not using dockerfile directly to prepare the agent 

    options {
        ansiColor('xterm')
        skipDefaultCheckout() // removes the "Declarative Checkout SCM" stage
    }

    stages {
       stage ('Checkout') {
          checkout scm
       }
    }
    post { // causes the "Declarative Post Actions" stage
       ...
    }
}

I managed to get rid of Declarative Agent Setup and Declarative Checkout SCM

Still no idea about how to fix the Gap