Jenkins管道的质量门状态不起作用

时间:2019-01-31 09:29:03

标签: jenkins jenkins-pipeline jenkins-groovy

在检查流水线中的质量门状态时,出现以下错误。

管道代码在下面

    stage('SonarQube') {
      // Run the maven build
            dir("xyz_7.6_Trunk/xyz-services"){


                sh ' mvn -f pom.xml clean install -Dapp.server=jboss org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.host.url=http://10.11.135.66:9000 -Dsonar.scm.disabled=True -U' 

            }
            }

stage('Quality Gate') {
timeout(time: 1, unit: ‘HOURS’) {
def qg = waitForQualityGate()
if (qg.status != ‘OK’) {
error “Pipeline aborted due to quality gate failure: ${qg.status}”
}
}
}

下面是错误日志。

java.lang.NoSuchMethodError: No such DSL method 'Time' 'HOURS' found among steps [acceptGitLabMR, addBadge, addErrorBadge, addGitLabMRComment, addHtmlBadge, addInfoBadge, addShortText, addWarningBadge, ansiblePlaybook, ansibleTower, ansibleVault, archive, artifactPromotion, bat, build, catchError, checkout, createSummary, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerNode, ec2, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, getContext, git, gitChangelog, gitlabBuilds, gitlabCommitStatus, input, isUnix, junit, library, libraryResource, load, mail, milestone, nexusArtifactUploader, nexusPolicyEvaluation, nexusPublisher, node, parallel, powershell, properties, pwd, readFile, readTrusted, removeBadges,  

1 个答案:

答案 0 :(得分:0)

如我所见,您使用脚本化管道,因此语法应该没问题。

timeout功能在Pipeline: Basic Steps插件(Pipeline插件的一部分)中实现。因此,我认为您需要重新安装这些插件,并且该问题应已解决。无论如何,请再次检查timeout步骤的syntax