提问人:Kev 提问时间:10/13/2023 最后编辑:Kev 更新时间:10/13/2023 访问量:42
未找到发布“/home/vsts/work/r1/a/owaspzap/report.xml”的结果
No Result Found to Publish '/home/vsts/work/r1/a/owaspzap/report.xml
问:
我有一个带有 Handlebars 的 OWASP ZAP 的 Azure 发布管道,它似乎正在运行,但没有创建任何报告。 使用的代理是 ubuntu-latest 运行后,我们看到这个
这里我们有 yaml 详细信息
安装 Docker
steps:
- task: DockerInstaller@0
displayName: 'Install Docker'
运行 ZAP 扫描
steps:
- task: CSE-DevOps.zap-scanner.custom-build-release-task.owaspzap@1
displayName: 'Run ZAP Scan'
inputs:
scantype: targetedScan
url: '$(targetUrl)'
port: 443
continueOnError: true
安装车把
steps:
- bash: |
sudo npm install -g handlebars-cmd
cat <<EOF > owaspzap/nunit-template.hbs
{{#each site}}
<test-run id="2" name="Owasp test" start-time="{$generatedDateTime}">
<test-suite id="{{@index}}" type="Assembly" name="{{[@name]}}" result="Failed" failed="{{alerts.length}}">
<attachments>
<attachment>
<filePath>owaspzap/report.xml</filePath>
</attachment>
</attachments>
{{#each alerts}}
<test-case id="{{@index}}" name="{{alert}}" result="Failed" fullname="{{alert}}" time="1">
<failure>
<message>
<![CDATA[{{{desc}}}]]>
</message>
<stack-trace>
<![CDATA[ Solution: {{{solution}}} Reference: {{{reference}}}
instances:{{#each instances}}
* {{uri}} - {{method}}
{{#if evidence}}- {{{evidence}}}{{/if}}
{{/each}}
]]>
</stack-trace>
</failure>
</test-case>
{{/each}}
</test-suite>
</test-run>
{{/each}}
EOF
运行车把
handlebars owaspzap/report.json < owaspzap/nunit-template.hbs > owaspzap/report.xml
发布测试结果
steps:
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: NUnit
testResultsFiles: '**/report.xml'
condition: succeededOrFailed()
因此,当每个步骤依次执行时 Docker -> 按预期
运行 ZAP 扫描 -> 完成,并显示通过和警告
2023-10-13T10:14:10.2051037Z ##[部分]完成:运行ZAP扫描
安装车把
2023-10-13T10:25:01.5572261Z ##[section]Starting: Install Handlebars
2023-10-13T10:25:01.5577334Z ==============================================================================
2023-10-13T10:25:01.5577640Z Task : Bash
2023-10-13T10:25:01.5577730Z Description : Run a Bash script on macOS, Linux, or Windows
2023-10-13T10:25:01.5578054Z Version : 3.229.0
2023-10-13T10:25:01.5578160Z Author : Microsoft Corporation
2023-10-13T10:25:01.5578337Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
2023-10-13T10:25:01.5578727Z ==============================================================================
2023-10-13T10:25:01.6839367Z Generating script.
2023-10-13T10:25:01.6855434Z ========================== Starting Command Output ===========================
2023-10-13T10:25:01.6865786Z [command]/usr/bin/bash /home/vsts/work/_temp/f63af849-5335-40d3-8f13-4f026b736e26.sh
2023-10-13T10:25:03.2065356Z
2023-10-13T10:25:03.2091678Z added 8 packages in 907ms
2023-10-13T10:25:03.2103187Z npm notice
2023-10-13T10:25:03.2104069Z npm notice New major version of npm available! 9.8.1 -> 10.2.0
2023-10-13T10:25:03.2105069Z npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.0>
2023-10-13T10:25:03.2105826Z npm notice Run `npm install -g [email protected]` to update!
2023-10-13T10:25:03.2106531Z npm notice
运行车把
2023-10-13T10:25:03.2467184Z ##[section]Starting: Run Handlebars
2023-10-13T10:25:03.2472295Z ==============================================================================
2023-10-13T10:25:03.2472599Z Task : Bash
2023-10-13T10:25:03.2472689Z Description : Run a Bash script on macOS, Linux, or Windows
2023-10-13T10:25:03.2472996Z Version : 3.229.0
2023-10-13T10:25:03.2473101Z Author : Microsoft Corporation
2023-10-13T10:25:03.2473276Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
2023-10-13T10:25:03.2473664Z ==============================================================================
2023-10-13T10:25:03.3631426Z Generating script.
2023-10-13T10:25:03.3648695Z Script contents:
2023-10-13T10:25:03.3650670Z handlebars owaspzap/report.json < owaspzap/nunit-template.hbs > owaspzap/report.xml
2023-10-13T10:25:03.3658036Z ========================== Starting Command Output ===========================
2023-10-13T10:25:03.3676643Z [command]/usr/bin/bash /home/vsts/work/_temp/38b8e342-43ed-4f13-b53e-d1093a7a4906.sh
2023-10-13T10:25:03.4738108Z ##[section]Finishing: Run Handlebars
发布测试结果
2023-10-13T10:25:03.4760402Z ##[section]Starting: Publish Test Results
2023-10-13T10:25:03.4765644Z ==============================================================================
2023-10-13T10:25:03.4765943Z Task : Publish Test Results
2023-10-13T10:25:03.4766112Z Description : Publish test results to Azure Pipelines
2023-10-13T10:25:03.4766394Z Version : 2.229.1
2023-10-13T10:25:03.4766500Z Author : Microsoft Corporation
2023-10-13T10:25:03.4766680Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-test-results
2023-10-13T10:25:03.4767168Z ==============================================================================
2023-10-13T10:25:03.6101747Z [command]/usr/bin/dotnet --version
2023-10-13T10:25:03.8951150Z 7.0.401
2023-10-13T10:25:05.4385385Z Result Attachments will be stored in LogStore
2023-10-13T10:25:05.4752578Z Run Attachments will be stored in LogStore
2023-10-13T10:25:05.5280244Z No Result Found to Publish '/home/vsts/work/r1/a/owaspzap/report.xml'.
2023-10-13T10:25:05.5448680Z ##[section]Async Command Start: Publish test results
2023-10-13T10:25:05.8770289Z ##[section]Async Command End: Publish test results
2023-10-13T10:25:05.8771674Z ##[section]Finishing: Publish Test Results
在这里,您可以看到没有找到任何结果,请提出任何想法。
答: 暂无答案
评论