Sergej Werfel
Sergej Werfel

Reputation: 1365

Jenkins Pipeline (Workflow) Stage View disappears

I have the problem, that in some Jenkins Pipeline projects the Stage View becomes invisible.

Usually, you can see the stage view between "Recent Changes" and "Permalinks". After some runs of a project, the Stage View disappears. If I clone the project, then the view is visible in the clone, but not in the original project.

It's a workaround to clone the project, but not a good one because I cannot replace the job every week.

Has someone seen that problem before and has an idea, how to fix that?

The stage view div, is on the job overview page, but it's not visible:

<div class="cbwf-stage-view">
    <div class="cbwf-widget cbwf-controller-applied pipeline-staged" objecturl="/user/myname/my-views/view/MaintainedByMe/job/Category/job/ProjectName/" fragcaption="Stage View" cbwf-controller="pipeline-staged"></div>
    <link rel="stylesheet" href="/adjuncts/ee6b655e/org/jenkinsci/pipeline/stageview_adjunct.css" type="text/css">
    <script src="/adjuncts/ee6b655e/org/jenkinsci/pipeline/stageview_adjunct.js" type="text/javascript"></script>
</div>

My Jenkinsfile:

def sonarHostUrl = 'http://sonar.host.url:1234'

node('Build') {
    echo "enforce a clear workspace:" // because there were some other problems
    deleteDir()

    stage('Checkout') {
        checkoutFromSVN()
    }
    stage('Compile') {
        mvn 'clean compile test-compile'
    }
    stage('Unit Tests') {
        mvn '-B org.jacoco:jacoco-maven-plugin:prepare-agent test'
        step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
    }
    stage('Deploy to Nexus') {
        mvn 'install deploy -DskipTests'
        archiveArtifacts artifacts: '**/project-name*.jar', onlyIfSuccessful: false
    }
    stage('Local Integration Tests') {
        mvn '-B org.jacoco:jacoco-maven-plugin:prepare-agent-integration failsafe:integration-test failsafe:verify'
        step([$class: 'JUnitResultArchiver', testResults: '**/target/failsafe-reports/TEST-*.xml'])
    }
    stage('Sonar'){
        mvn "org.sonarsource.scanner.maven:sonar-maven-plugin:3.1.1:sonar -Dsonar.host.url=$sonarHostUrl"
    }
}
stage('Deploy to DEV') {
    build 'JobThatDeploysTheApplicationToDevEnv'
}
stage('Functional Tests') {
    build job: 'JobWithSoapUITests', parameters: [string(name: 'TESTENVIRONMENT', value: 'DEV')]
}

def checkoutFromSVN(){
    checkout([$class: 'SubversionSCM', 
            excludedCommitMessages: '.*\\[maven-release-plugin\\].*',
            locations: [[credentialsId: 'a1a2b3c4-1234-ab1d-b56c-0ac4bff23a6c', 
                       depthOption: 'infinity', 
                       ignoreExternalsOption: true, 
                       excludedRegions: 'Jenkinsfile',
                       local: 'project-dir', 
                       remote: 'https://url.to/project-dir']], 
            workspaceUpdater: [$class: 'CheckoutUpdater']])
}

def mvn(String args) {
    def mvnCmd = "${tool name: 'Maven 3.3.9', type: 'hudson.tasks.Maven$MavenInstallation'}/bin/mvn"

    wrap([$class: 'ConfigFileBuildWrapper', 
          managedFiles: [[
                    fileId: 'org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig1234567', 
                    targetLocation: '', // temporary file
                    variable: 'MAVEN_SETTINGS']]]) {
        bat "${mvnCmd} -s ${env.MAVEN_SETTINGS} ${args} -f project-dir/pom.xml"
    }
}

My Job configuration exported as XML:

<?xml version='1.0' encoding='UTF-8'?>
<flow-definition plugin="[email protected]">
  <actions/>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties>
    <jenkins.model.BuildDiscarderProperty>
      <strategy class="hudson.tasks.LogRotator">
        <daysToKeep>-1</daysToKeep>
        <numToKeep>10</numToKeep>
        <artifactDaysToKeep>-1</artifactDaysToKeep>
        <artifactNumToKeep>-1</artifactNumToKeep>
      </strategy>
    </jenkins.model.BuildDiscarderProperty>
    <org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
      <triggers>
        <hudson.triggers.TimerTrigger>
          <spec>H H * * *</spec>
        </hudson.triggers.TimerTrigger>
        <hudson.triggers.SCMTrigger>
          <spec>H/10 7-18 * * *</spec>
          <ignorePostCommitHooks>false</ignorePostCommitHooks>
        </hudson.triggers.SCMTrigger>
      </triggers>
    </org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
  </properties>
  <definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="[email protected]">
    <scm class="hudson.scm.SubversionSCM" plugin="[email protected]">
      <locations>
        <hudson.scm.SubversionSCM_-ModuleLocation>
          <remote>https://url.to/project-dir</remote>
          <credentialsId>a1a2b3c4-1234-ab1d-b56c-0ac4bff23a6c</credentialsId>
          <local>.</local>
          <depthOption>infinity</depthOption>
          <ignoreExternalsOption>true</ignoreExternalsOption>
        </hudson.scm.SubversionSCM_-ModuleLocation>
      </locations>
      <excludedRegions></excludedRegions>
      <includedRegions>Jenkinsfile</includedRegions>
      <excludedUsers></excludedUsers>
      <excludedRevprop></excludedRevprop>
      <excludedCommitMessages></excludedCommitMessages>
      <workspaceUpdater class="hudson.scm.subversion.UpdateWithRevertUpdater"/>
      <ignoreDirPropChanges>false</ignoreDirPropChanges>
      <filterChangelog>false</filterChangelog>
    </scm>
    <scriptPath>Jenkinsfile</scriptPath>
  </definition>
  <triggers/>
</flow-definition>

Upvotes: 23

Views: 41117

Answers (9)

Gonzalo Cugiani
Gonzalo Cugiani

Reputation: 660

By default when installing Jenkins or currently with newer versions, Pipeline: stage view plugin version 2.34 is disabled in the dashboard how you can see below.

enter image description here

So, you need to go to manage jenkins > plugins and just install it to apply or extend again that functionality in the 'available plugins' section at left panel options:

enter image description here

Then, you will see in your dashboard the stage view available again to check your steps properly.

enter image description here

Upvotes: 3

Bilal
Bilal

Reputation: 1

Try reloading the configuration and it should come back. Dashboard -> Manage Jenkin -> Reload Configuration from Disk

Upvotes: 0

not2savvy
not2savvy

Reputation: 4243

This happened here after one these events

  • Changing the pipeline file (Jenkinsfile)
  • Changing the job name

However, after a while, the stage view re-appeared. Sometimes it took as long as 30 minutes. The mechanism behind this remains a mistery to me.

So my advice is to be patient before taking any further action.

Upvotes: 0

scrutari
scrutari

Reputation: 1618

Just in case you may have lost the "pipeline-stage-view" plugin, check if it's installed. In my case that was it.

Upvotes: 10

Ahmed Tawfik
Ahmed Tawfik

Reputation: 1639

For our Jenkins, it turned out the plugin Pipeline Stage View had gone missing, or was somehow not installed during a refresh of the Jenkins installation. Ocean Blue was still working, but the plain cell-based view had disappeared.

Upvotes: 0

hit3k
hit3k

Reputation: 1493

If you create a copy of the pipeline without the Stage View - the copy will have it.

  • Dashboard > New Item > on the left hand menu
  • Give it a name
  • Copy from > at the bottom > type name of you pipeline

Enjoy =)

Upvotes: 0

Damian
Damian

Reputation: 550

I've observed this problem when switching off test trends for the build. Then also "Stage View" disappeared so there must be some conflict between other plugin rather then Jenkins itself.

I also observed that there were no changes on view or build history after that modification so then I simple clone the project and delete the old one. The side effect of this is that the build history has gone.

Upvotes: 0

Xuezhong
Xuezhong

Reputation: 81

I resolved the issue by manually copying the missing file to the Jenkins server job.

My detail steps:

  1. Open pipeline page.
  2. Press F12 in Chrome.
  3. Check Console for errors.

my error was missing "\jobs\Dev-Linux-UI\builds\21\workflow\3.xml", I copied the file from builds\20\workflow\3.xml.

It seems that the file is missing during the copy as Jenkins pipeline is not stable enough.

Upvotes: 7

Clint Chapman
Clint Chapman

Reputation: 126

When I've see it, it was after restarting jenkins. If you look in the debugger in a browser, you'll see it's trying to load files that don't exist. I've filed a bug for this but no response. Please vote for it if it's still something you're seeing: https://issues.jenkins-ci.org/browse/JENKINS-39143

Upvotes: 3

Related Questions