我正在尝试junit
使用脚本管道删除位于我的 Jenkins 作业工作区中的目录,它看起来有点像这样:
node {
stage('Build') {
checkout scm
app = docker.build("...")
}
stage('Test') {
app.withRun("--name = ${CONTAINER_ID} ...") {
// sh "mkdir -p junit"
// sh "rm -rf junit/"
dir "junit" {
deleteDir
}
sh "docker exec ${CONTAINER_ID} /bin/bash -c 'source venv/bin/activate && python run.py test -x junit'"
sh "docker cp ${CONTAINER_ID}:/home/foo/junit junit"
}
}
junit 'junit/*.xml'
}
但是我收到以下(red haring?)错误,例如
java.lang.ClassCastException: hudson.tasks.junit.pipeline.JUnitResultsStep.testResults 需要类 java.lang.String 但收到类 org.jenkinsci.plugins.workflow.cps.CpsClosure2
但是,当我使用 shell 步骤时:
sh "mkdir -p junit"
sh "rm -rf junit/"
它按预期工作。我究竟做错了什么?
尝试使用括号:
dir ("junit") {
deleteDir()
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句