有人可以帮我解决我的问题吗?
我目前有一个Jenkins管道项目,该项目在远程计算机上并行运行自动化测试。 我正在使用allure进行报告,并且当将其保存到单个节点时,它可以正常工作。但是,当尝试生成第二个报告(相同的测试,使用不同的浏览器)时,似乎导致jar文件损坏。它的行为符合我对前4/5版本的预期,然后引发此错误:
java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1400(Unknown Source)
at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.ensureLoaded(ByteSourceJsonBootstrapper.java:489)
at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.detectEncoding(ByteSourceJsonBootstrapper.java:126)
at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.constructParser(ByteSourceJsonBootstrapper.java:215)
at com.fasterxml.jackson.core.JsonFactory._createParser(JsonFactory.java:1238)
at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:807)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2264)
at ru.yandex.qatools.allure.jenkins.utils.FilePathUtils.isHistoryNotEmpty(FilePathUtils.java:85)
at ru.yandex.qatools.allure.jenkins.utils.FilePathUtils.getPreviousReportWithHistory(FilePathUtils.java:70)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.addHistory(AllureReportPublisher.java:402)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.prepareResults(AllureReportPublisher.java:371)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:217)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:50)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
在安装全新版本的jenkins之前,这种做法一直存在。 我确定我肯定出了点问题,但是我不确定这是否是错误。
管道脚本如下:
node{
stage("Clean Workspace"){
parallel firefox:{
node('master'){
cleanWs notFailBuild: true, patterns: [[pattern: 'TestResult.xml', type: 'EXCLUDE']]
}
},chrome:{
node('Chrome'){
cleanWs notFailBuild: true, patterns: [[pattern: 'TestResult.xml', type: 'EXCLUDE']]
}
}
}
stage('Checkout Code'){
parallel firefox:{
node('master'){
git credentialsId: **Removed**
}
}, chrome:{
node('Chrome'){
git credentialsId: **Removed**
}
}
}
stage('Restore NuGet'){
parallel firefox:{
node('master') {
bat '"C:/ProgramData/chocolatey/lib/NuGet.CommandLine/tools/nuget.exe" restore PurpleAutomationSuite.sln'
}
}, chrome:{
node('Chrome') {
bat '"C:/ProgramData/chocolatey/lib/NuGet.CommandLine/tools/nuget.exe" restore PurpleAutomationSuite.sln'
}
}
}
stage('Build'){
parallel firefox:{
node('master') {
bat "\"${tool 'MSBuildLocal'}\" PurpleAutomationSuite.sln /p:Configuration=Debug /p:Platform=\"Any CPU\" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"
}
}, chrome:{
node('Chrome') {
bat "\"${tool 'MSBuildLocal'}\" PurpleAutomationSuite.sln /p:Configuration=Debug /p:Platform=\"Any CPU\" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"
}
}
}
stage('Test'){
try{
parallel firefox:{
node('master') {
bat '"C:/ProgramData/chocolatey/lib/nunit-console-runner/tools/nunit3-console.exe" --result=C:/Users/Jenkins/.jenkins/workspace/CrossBrowserTesting@2/TestResult.xml --params:Browser=Firefox PurpleAutomationSuite/bin/Debug/PurpleAutomationSuite.dll '
}
}, chrome:{
node('Chrome') {
bat '"C:/ProgramData/chocolatey/lib/nunit-console-runner/tools/nunit3-console.exe" --result=C:/jenkins/workspace/CrossBrowserTesting/TestResult.xml --params:Browser=Firefox PurpleAutomationSuite/bin/Debug/PurpleAutomationSuite.dll'
}
}
} catch (e) {
result = "FAIL"
}
}
stage("PublishTestReport"){
parallel firefox:{
node('master') {
allure includeProperties: false, jdk: '', results: [[path: 'CrossBrowserTesting@2']]
}
}, chrome:{
node('Chrome') {
allure includeProperties: false, jdk: '', results: [[path: 'CrossBrowserTesting']]
}
}
}
}
编辑:只是要添加两个工作区是分开的,而我正在使用最新版本的管道插件