jenkins - Jenkins 管道无法正常工作的质量门状态
问题描述
在检查管道中的质量门状态时,出现以下错误。
管道代码如下
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,
解决方案
如我所见,您使用脚本化管道,因此语法应该没问题。
timeout
功能在Pipeline: Basic Steps
插件(插件的一部分Pipeline
)中实现。这就是为什么我认为您需要重新安装这些插件并且应该解决问题。无论如何,请再次检查该步骤的语法。timeout
推荐阅读
- python - Docker 来自图像 python:3.6 apk-get not fount
- python - 在 anaconda 环境中使用 pyinstaller 来打包程序并发出警告:找不到 lib
- python - 如何在python中将for循环的增量设置为1?
- php - 当我foreach一个php数组时如何换行?
- javascript - 如何使用 javascript 创建 HTML 选择菜单选项
- jmeter - 如何分析 JMeter jlt 输出(命令行非 GUI 模式)?
- django - 在 django 中,有没有办法限制用户访问 url 及其所有子 url?
- python - 如何在没有循环的情况下将二维关联数组保存在 csv 中?
- ios - 地图移动时在地图上显示 5 000 个图钉会滞后
- perl - 按多列对数据库中的现有用户进行排序