question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Since today 23.6.22 after 10:30CET publish test results does not work anymore in azure pipelines

See original GitHub issue

Describe the issue This line appears suddenly. No change from our side. Using latest checkov container.

##[warning]Failed to read /home/vsts/work/1/s/CheckovReport/Checkov-Report.xml. Error : Data at the root level is invalid. Line 2, position 1..

##[debug]PublishTestResults.OverrideExeFlow=undefined
##[debug]OS type: Linux
##[debug]TestManagement.Server.UsePublishTestResultsLibInAgent is on
##[debug]Object of TestLogStore created.
Result Attachments will be stored in LogStore
##[debug]Object of TestResultsPublisher created.
##[debug]Object of TestLogStore created.
Run Attachments will be stored in LogStore
##[debug]Object of TestRunPublisher created.
##[debug]Object of TestLogStore created.
##[debug]Object of JUnitResultParser created.
##[debug]Entering ParseTestResultFiles
##[debug]runContext.ReleaseURI is null
##[debug]runContext.ReleaseEnvironmentUri is null
##[debug]Reading test results from file '/home/vsts/work/1/s/CheckovReport/Checkov-Report.xml'.
##[warning]Failed to read /home/vsts/work/1/s/CheckovReport/Checkov-Report.xml. Error : Data at the root level is invalid. Line 2, position 1..
##[debug]Leaving ParseTestResultFiles
##[debug]Processed: ##vso[results.publish type=JUnit;mergeResults=false;runTitle=Checkov Scan;publishRunAttachments=true;resultFiles=/home/vsts/work/1/s/CheckovReport/Checkov-Report.xml;failTaskOnFailedTests=false;testRunSystem=VSTS - PTR;]
##[debug]task result: Succeeded
##[debug]Processed: ##vso[task.complete result=Succeeded;]
##[debug]Release.ReleaseUri=undefined
##[debug]Release.ReleaseId=undefined
##[debug]Build.BuildUri=vstfs:///Build/Build/29918
##[debug]Build.Buildid=29918
##[debug]Uploading build level attachements individually
##[debug]runContext.ReleaseURI is null
##[debug]runContext.ReleaseEnvironmentUri is null
##[debug]Entering PublishToNewTestRunPerTestResultFileAsync
##[debug]Leaving PublishToNewTestRunPerTestResultFileAsync
##[debug]Processed: ##vso[telemetry.publish area=TestExecution;feature=PublishTestResultsTask]{"builduri":"vstfs:///Build/Build/29918","buildid":"29918","osType":"Linux","testRunner":"JUnit","failTaskOnFailedTests":"false","mergeResultsUserPreference":"false","testResultsFilesCount":1,"dotnetVersion":"6.0.301","subFeature":"publishTestResultsTaskConsolidatedCiEvent"}
Async Command Start: Publish test results
##[debug]Total build level attachments: 0.
##[debug]TestManagement.PTR.CalculateTestRunSummary is on
##[debug]RESOURCE_URIS:
##[debug]Setting task variable METADATA_c49e0f02-4dd1-4e4b-8920-2742e06dfde8: {"name":"8db11c57-980a-4ef8-b275-14abf7190ec9","resourceUris":[],"metadata":{"description":"","relatedUrls":[{"url":"[https://dev.azure.com/SulzerChemtech/chemtech/_build/results?buildId=29918","label":"pipeline-url"}],"humanReadableName":"Test](https://dev.azure.com/SulzerChemtech/chemtech/_build/results?buildId=29918%22,%22label%22:%22pipeline-url%22}],%22humanReadableName%22:%22Test) Results from Publish Test Results utility","serializedPayload":"{\"testId\":\"PublishTestResults\",\"testTool\":\"JUnit\",\"testResultAttestation\":{\"total\":0,\"failed\":0,\"passed\":0,\"skipped\":0},\"testDurationSeconds\":0.0,\"testPassPercentage\":\"0\",\"relatedUrls\":[{\"url\":\"[https://dev.azure.com/SulzerChemtech/chemtech/_build/results?buildId=29918\",\"label\":\"pipeline-url\"}]}"}}](https://dev.azure.com/SulzerChemtech/chemtech/_build/results?buildId=29918\%22,\%22label\%22:\%22pipeline-url\%22}]}%22}}) 
##[debug]TestManagement.Agent.PTR.EnableFlakyCheck is on
##[debug]TestManagement.Server.TriggerCoverageMergeJob is on
##[debug]Exception in Method:Data at the root level is invalid. Line 2, position 1.
Async Command End: Publish test results
Finishing: Publish Checkov Quality Analysis Result

Examples This is our checkov Template:

---
parameters:
  - name: workingDirectory
    type: string
    default: $(System.DefaultWorkingDirectory)
  - name: azRegion
    type: string
    default: $(azRegion)
  - name: tfStorageRg
    type: string
    default: rg-tf-stor
  - name: tfStorageAccName
    type: string
    default: stacctf$(Build.Repository.Name)
  - name: tfSourceBranchName
    type: string
    default: $(srcBranchName)
  - name: tfPrevPRId
    type: string
    default: $(prevPrId)
  - name: env
    type: string
    default: $(env)
  - name: outputFileName
    type: string
    default: Checkov-Report.xml

steps:
  - task: Bash@3
    displayName: Run Checkov Quality Analysis
    inputs:
      targetType: "inline"
      script: |
        mkdir ${{ parameters.workingDirectory }}/CheckovReport
        docker run --tty --volume ${{ parameters.workingDirectory }}:/scan --workdir /scan bridgecrew/checkov:latest --directory /scan --output junitxml > ${{ parameters.workingDirectory }}/CheckovReport/${{ parameters.outputFileName }}

        # Remove the last two lines because the report is wrongly formatted
        sed -i '$d' ${{ parameters.workingDirectory }}/CheckovReport/${{ parameters.outputFileName }}
        sed -i '$d' ${{ parameters.workingDirectory }}/CheckovReport/${{ parameters.outputFileName }}

  - task: PublishTestResults@2
    displayName: Publish Checkov Quality Analysis Result
    condition: succeededOrFailed()
    inputs:
      testResultsFormat: "JUnit"
      testResultsFiles: "**/*.xml"
      searchFolder: "${{ parameters.workingDirectory }}/CheckovReport"
      mergeTestResults: false
      testRunTitle: Checkov Scan
      failTaskOnFailedTest: true
      publishRunAttachments: true

Version (please complete the following information):

  • Checkov Version latest docker image

Additional context From what I see of your push activity to docker hub and our pipelines, I can correlate that this must be somewhere in between the push from 2.0.1230 to 2.1 which was 7h ago. Anyway, our Pipeline worked last time 10:12am CET. 10:45am CET the checkov task failed. You pushed 2.1 at 10:34am which broke the pipelines

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
slzmrueppcommented, Jun 23, 2022

Perfect. Thanks a lot. Close the issue now

0reactions
AdamSir2commented, Jul 7, 2022

Has anyone tested this on docker-compose to see if it works?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Publish test results does not fail pipeline when publishing ...
Hi,. I noticed this issue in two of my CI pipelines that use the "Publish Test Results" task. The "Fail if there are...
Read more >
PublishTestResults@2 - Publish Test Results v2 task
Publish test results to Azure Pipelines. ... When this boolean's value is true , the task reports test results from all the files...
Read more >
Publishing test results in AzureDevops Hangs - Stack Overflow
The problem is that our agents are behind a proxy. We provided the proxy settings as per the instructions but it appears the...
Read more >
Publishing test results with failed tests does not fail the build
The results get published correctly and we can see that some tests failed. When tests fail, however, the build is not marked as...
Read more >
Azure Devops Publish Test Results With Links To Requirement
On GitHub, navigate to the Microsoft/ContosoAir repository. We'll replace the contents with the final YAML required for our project. We will add tasks...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found