2016-11-30 250 views
2

我遇到問題,在一些Jenkins管道項目中,階段視圖變得不可見。Jenkins管道(工作流程)階段視圖消失

通常,您可以看到「最近更改」和「固定鏈接」之間的舞臺視圖。在項目運行一段時間後,舞臺視圖消失。如果我克隆項目,那麼該視圖在克隆中可見,但不在原始項目中。

這是克隆項目的解決方法,但不是一個好的方法,因爲我無法每週都替換這個項目。

有人看到過這個問題,並有一個想法,如何解決這個問題?

舞臺視圖DIV,是工作概述頁面上,但它是不可見的:

<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>

我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" 
    } 
} 

我的作業配置導出爲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> 
+1

你並不孤單。我也看到了這個問題(也沒有解決)。什麼「幫助」是清除所有舊版本(當然 - 這是一個插件)。 – jherb

+0

感謝提醒您清除舊版本。順便說一下,如果您更改項目以放棄舊版本(最大構建數量保持= 1),並在一次構建後撤消更改,那麼它也可以在沒有插件的情況下很好地工作。然而,問題仍然存在,因爲我想,我的歷史仍然在項目中。 –

回答

0

當我看到它時,它是在重新啓動jenkins之後。如果你在瀏覽器中查看調試器,你會發現它試圖加載不存在的文件。我已經爲此提交了一個錯誤,但沒有迴應。請投票,如果它仍然是你看到的東西:https://issues.jenkins-ci.org/browse/JENKINS-39143

1

我解決了問題,手動將缺少的文件複製到Jenkins服務器作業。

我的詳細步驟:

  1. 打開管道頁。
  2. 在Chrome中按F12。
  3. 檢查控制檯是否有錯誤。

我的錯誤缺失 「\工作\開發Linux的-UI \建立\ 21 \工作流程\ 3.XML」,我複製從文件建立\ 20 \工作流程\ 3.XML

由於Jenkins管道不夠穩定,似乎文件在複製過程中缺失。