我在通过Jenkinsfile运行作业时遇到问题。现在,该工作开始进行,直到建立阶段,此后每个阶段都失败了。我还为接收到的控制台输出附加了一个图像。
到处搜索但没有任何解决方案,也不知道我在代码中哪里出错了。 [![在此处输入图片描述] [1]] [1]
parameters {
booleanParam(defaultValue: true, description: 'Execute Pipeline?', name: 'GO')
}
agent {label 'test'}
stages {
stage('Preconditions'){
steps {
script {
result = sh (script: "git log -1 | grep ' _*\\[ci skip\\].*'", returnStatus: true)
if (result == 0) {
echo "This build should be skipped. Aborting"
GO = "false"
}
}
}
}
stage('Build'){
steps {
script {
sh "pip install -r requirements.txt"
sh "mkdir -p ${out}/results"
}
}
}
stage('Smoke') {
steps {
script {
sh "robot -d results -i Smoke -v BROWSER:chrome test_suites"
currentBuild.result = 'SUCCESS'
}
}
}
stage('Sanity') {
steps {
script {
sh "robot -d results -i Sanity -v BROWSER:chrome test_suites"
currentBuild.result = 'SUCCESS'
}
}
}
stage('Process Results') {
steps {
script {
bat 'del "Results\\*.zip"'
zip zipFile: 'results/results.zip', archive: false, dir: 'results', glob: '*.html'
step([
$class : 'RobotPublisher',
outputPath : 'results',
outputFileName : "output.xml",
reportFileName : 'report.html',
logFileName : 'log.html',
disableArchiveOutput : false,
passThreshold : 95.0,
unstableThreshold: 95.0,
otherFiles : "**/*.png",
])
}
}
}
}
post {
always {
googlechatnotification url:
}
}
}````
The requirements.txt files contain all the bindings like:
selenium==3.141.0
virtualenv==16.5.0
robotframework==3.1.1
robotframework-pabot==0.53
robotframework-seleniumlibrary==3.3.1
robotframework-react==1.0.0a2
[![Console Output][2]][2]
[1]: https://i.stack.imgur.com/FPPPz.png
答案 0 :(得分:0)
我想失败的命令是在results
阶段创建Build
目录,因为变量${out}
的语法是常规的,而不是shell的:
stage('Build'){
steps {
script {
sh "pip install -r requirements.txt"
sh "mkdir -p ${out}/results"
}
}
}