Skip to content

False validation error for PublishCodeCoverageResults@2 in azure-pipelines.yml #644

Description

@NikolayGurinov

Description

VS Code shows a false validation error for a valid Azure Pipelines task in azure-pipelines.yml.

The pipeline runs successfully in Azure DevOps, but in the editor I get errors like:

  • PublishCodeCoverageResults is deprecated
  • String does not match the pattern of "^PublishCodeCoverageResults@1$"
Image

The task in the YAML is:

- task: PublishCodeCoverageResults@2
  condition: and(always(), eq(variables.conditionRulePR, true))
  inputs:
    summaryFileLocation: '$(Agent.TempDirectory)/changed_only_report/Cobertura.xml'
    pathToSources: '$(buildContextDirectory)'
    failIfCoverageEmpty: false

Why this looks wrong

The tooltip/schema info shows PublishCodeCoverageResults@2 as an allowed value, but validation still reports that the task must match ^PublishCodeCoverageResults@1$.

So the schema/validation appears to be internally inconsistent.

Environment
• VS Code: latest
• Red Hat YAML extension installed
• Azure Pipelines extension was uninstalled, but the issue still reproduces
• File language mode: YAML
• The current file is still associated with Azure Pipelines YAML pipelines definition

Minimal repro:

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
- task: PublishCodeCoverageResults@2
  inputs:
    summaryFileLocation: 'coverage.xml'
    pathToSources: '.'
    failIfCoverageEmpty: false

Expected behavior

PublishCodeCoverageResults@2 should not be marked as deprecated or invalid.

Actual behavior

The editor highlights valid YAML in red and reports a false validation error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions