Azure-pipelines-tasks: PublishCodeCoverageResults can't find its own html report when the agent is installed to a dir with a space in the name

Created on 4 Jun 2020  路  8Comments  路  Source: microsoft/azure-pipelines-tasks

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: PublishCodeCoverageResults@1

Environment

  • Server - Azure Pipelines

  • Agent - Hosted or Private:

    - Self hosted agent: vsts-agent-win-x64-2.168.2
    
    • Windows Server 2019 (1809)

Issue Description

Task is configured to process a cobertura-coverage.xml produced by jest

        - task: PublishCodeCoverageResults@1
          inputs:
            codeCoverageTool: 'Cobertura'
            summaryFileLocation: './coverage/cobertura-coverage.xml'
            failIfCoverageEmpty: true

On execution, the task processes this and writes the report to a new (unexpected?) directory

Writing report file 'D:\Azure\index.htm'

This and other output files representing the source files are written correctly.
The cobertura-coverage.xml is uploaded as an artifact.

However the task then states

Generated code coverage html report: D:\Azure Agent\vsts-agent-win-x64-2.168.2\_work\_temp\cchtml

and generates a warning

##[warning]Directory not found: 'D:\Azure Agent\vsts-agent-win-x64-2.168.2\_work\_temp\cchtml

There is nothing in that _temp directory.

If I specifically set reportDirectory to 'D:\Azure\' within the task it complains

[warning]Ignoring coverage report directory with Html content as we are auto-generating Html content

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-code-coverage-results?view=azure-devops doesn't document the reportDirectory option aside to say it's optional.

Have I come across a bug or is my configuration wrong?

Many thanks

CodeCoverage Test bug

Most helpful comment

Hi @DevRCRun, we've fixed this issue, but it may take a few weeks until the changes are deployed. We'll let you know once they're available.

All 8 comments

The warning

Ignoring coverage report directory with Html content as we are auto-generating Html content

went wait when removing reportDirectory in https://github.com/eps1lon/dom-accessibility-api/pull/289.

As far as I could tell this was only a warning. Everything was working as expected.


Initialize job log

Starting: Initialize job
Agent name: 'Azure Pipelines 2'
Agent machine name: 'fv-az101'
Current agent version: '2.170.1'
Operating System
Ubuntu
18.04.4
LTS
Virtual Environment
Environment: ubuntu-18.04
Version: 20200604.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu18/20200604.1/images/linux/Ubuntu1804-README.md
Current image version: '20200604.1'
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Downloading task: NodeTool (0.166.2)
Downloading task: CmdLine (2.164.2)
Downloading task: PublishPipelineArtifact (1.2.3)
Downloading task: DownloadPipelineArtifact (2.3.1)
Downloading task: PublishTestResults (2.170.0)
Downloading task: PublishCodeCoverageResults (1.160.3)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Finished checking job knob settings.
Start tracking orphan processes.
Finishing: Initialize job

Maybe something specific to windows self hosted agent then? Either with the reportDirectory set or not nothing got uploaded.

Let me know when your change should be available to the pipeline and I'll give it another try.

Ah. Is this the problem? If you look below is it choking on the space in targetdir? That would explain why it's creating a D:\Azure directory on its own initiative!

'
2020-06-15T14:41:02.2883739Z [command]"D:\Azure Agent\localservice_work_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\1.160.3\net47\ReportGenerator.exe" -reports:./coverage/cobertura-coverage.xml -targetdir:D:\Azure Agent\localservice_work_temp\cchtml -reporttypes:HtmlInline_AzurePipelines

2020-06-15T14:41:02.3443418Z 2020-06-15T15:41:02: Arguments

2020-06-15T14:41:02.3444601Z 2020-06-15T15:41:02: -reports:./coverage/cobertura-coverage.xml

2020-06-15T14:41:02.3445362Z 2020-06-15T15:41:02: -targetdir:D:\Azure

2020-06-15T14:41:02.3446093Z 2020-06-15T15:41:02: Agent\localservice_work_temp\cchtml

2020-06-15T14:41:02.3446863Z 2020-06-15T15:41:02: -reporttypes:HtmlInline_AzurePipelines'

I can confirm that the space in the directory name where the agent is installed is causing the problem. With the agent installed to a directory without a space in the path the issue does not occur and the report html is correctly uploaded. Renaming the issue to better reflect this.

It looks like the change in https://github.com/microsoft/azure-pipelines-tasks/pull/13861 to quote the path to the ReportGenerator.dll causes this task to break on Linux agents. I've added a full description of the problem here: https://github.com/microsoft/azure-pipelines-tasks/issues/13914#issuecomment-731019183.

Can this change be temporarily reverted until a fix that doesn't break the task can be made?

@adamconnelly yes. We will try and patch this immediately.

Hi @DevRCRun, we've fixed this issue, but it may take a few weeks until the changes are deployed. We'll let you know once they're available.

Hi @DevRCRun we have rolled out the fix for this issue, let me close this since it was fixed - please feel free to reopen it or ask any further questions if it's still actual for you.

Was this page helpful?
0 / 5 - 0 ratings