Publish Test Results task shown as incorrect
nerijusk opened this issue · 7 comments
Task catalog lists in Publish Test Results task as version 2 here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-test-results?view=azure-devops&tabs=trx%2Cyaml#yaml-snippet. However, in VSCode it flagged as incorrect and shown regex expects it to be of version 1. See attached screenshot. I guess the fix is trivial. Regex pattern should be changed from "^PublishTestResults@1$"
into "^PublishTestResults@(1|2)$"
or into "^PublishTestResults@2$"
in case version 1 of this task is deprecated.
Hi @nerijusk!
Thank you for your request,
we should show the correct version even if they're deprecated, so "^PublishTestResults@2$"
is not correct, but the option with "^PublishTestResults@(1|2)$"
seems really nice. so please feel free to create PR to the parent repo if you want and we will test & review it, otherwise, we will fix the issue once we will have capacity.
Started looking into where the fix should be made and found this: https://github.com/microsoft/azure-pipelines-vscode/blob/main/service-schema.json#L16601. Looks like the schema already has entry for PublishTestResults@2
task. Do you know why it's not being picked up or overriden by PublishTestResults@1
definition?
@nerijusk I rechecked the error with my VSCode from the first extension version to the last and unfortunately can't reproduce the error, could you please share some info about your os, vscode version and extension version and provide some part of code to reproduce the problem, I think it might be reproduced with some specific environment?
I'm running Ubuntu 22.04 with latest patches. Azure Pipelines extension v1.208.0. VSCode info:
Version: 1.70.2
Commit: e4503b30fc78200f846c62cf8091b76ff5547662
Date: 2022-08-16T05:36:25.715Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Linux x64 5.15.0-46-generic
Pipeline:
trigger: none
pool: PlatformUbuntu
stages:
- stage: runPsrule
displayName: Run PSRule tool
jobs:
- job: PSRuleAnalysis
displayName: Analyze Azure templates and Bicep modules
steps:
- task: ps-rule-assert@2
displayName: Analyze Azure template files
inputs:
inputPath: '$(System.DefaultWorkingDirectory)/'
path: '$(System.DefaultWorkingDirectory)/'
source: '$(System.DefaultWorkingDirectory)/PSRule/.ps-rule/'
option: '$(System.DefaultWorkingDirectory)/PSRule/ps-rule-options.yaml'
modules: 'PSRule.Rules.Azure'
baseline: 'Azure.Default'
outputFormat: 'NUnit3'
outputPath: '$(System.DefaultWorkingDirectory)/PSRule/reports/ps-rule-results.xml'
- task: PublishTestResults@2
displayName: 'Publish PSRule results'
condition: succeededOrFailed()
inputs:
testRunTitle: 'PSRule'
testRunner: NUnit
testResultsFiles: '$(System.DefaultWorkingDirectory)/PSRule/reports/ps-rule-results.xml'
mergeTestResults: true
publishRunAttachments: true
Actually, I think I found the reason. The task is highlighted as incorrect when I choose Language Mode as YAML and Select JSON schema as Azure Pipelines. It's not highlighted if I choose Language Mode as Azure Pipelines. See screenshots:
and
Does YAML mode use the schema for Azure Pipelines? If so, then this is still an issue. If not, where do I raise an issue for YAML+schema combination?
The Azure Pipelines extension actually only uses the service-schema in this repo as a last resort if you don't follow the prompts to enable schema auto-detection. (This file is also auto-generated and any manual changes will be clobbered on the next extension release.)
However, that's tangential to what you're asking.
Does YAML mode use the schema for Azure Pipelines?
This seems like it's coming from another extension you have installed - by default, VS Code doesn't provide any schema functionality for YAML files. You'll have to figure out which extension is providing schemas for YAML files and contact them.
Do you have any other questions, or are we okay to close this issue? :)
Thanks for help navigating through extensions. :)
This issue can be closed.