我被困在我的jenkins管道与sonarqube集成我读过其他职位和解决方案是更新持久的插件;然而我的插件是在最新版本v 493.v195aefbb0ff2
控制台输出:
Injecting SonarQube environment variables using the configuration: sq1
[Pipeline] {
[Pipeline] sh
process apparently never started in /var/lib/jenkins/workspace/DevOps Demo@tmp/durable-48ce628f
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE
字符串
我的Jenkinsfile如下
pipeline {
agent any
environment {
PATH = "/opt/maven"
BUILD_ID = 'BUILD_NUMBER'
}
stages {
stage('Get Code') {
steps {
echo 'Import code GitLab'
updateGitlabCommitStatus name: 'build', state: 'pending'
git branch: 'main', credentialsId: 'd6d909b7-d918-4ed3-b65f-426e3200a598', url: 'https://10.10.2.44/root/devops1.git'
echo 'build step goes here'
updateGitlabCommitStatus name: 'build', state: 'success'
}
}
stage('SonarQube analysis') {
steps {
withSonarQubeEnv(credentialsId: 'jenkins-sq', installationName: 'sq1') {
sh 'mvn sonar:sonar'
}
}
}
}
}
型
3条答案
按热度按时间qkf9rpyu1#
路径错误,必须包含docker jenkins的“/bin”。
字符串
v64noz0r2#
更正路径,如下所示:
字符串
我宁愿不覆盖整个PATH变量,而只是在其中添加更多的路径,并检查警告是否也会消失。
0mkxixxg3#
我也遇到了这个问题。首先,我升级了Jenkins持久插件,在我的情况下,这个解决方案并没有解决这个问题。经过深入调查,我发现PATH变量是问题所在。尝试在Jenkins环境中正确设置PATH变量。确保sh二进制文件从/bin位置可以在PATH上找到。您可以运行“which sh”来查看sh二进制文件的确切位置。
字符串