You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Pipeline YAML中number类型未被识别为整数的问题排查

Azure Pipeline YAML参数配置错误导致number类型识别失败的解决方法

你的问题出在两个核心错误上:

1. 参数结构定义错误

你当前的customers参数默认值把module和timeout拆成了独立的数组元素,而不是每个数组元素是同时包含这两个属性的对象。这就导致循环时,每次section要么是仅含module的对象,要么是仅含timeout的对象,Azure Pipeline无法识别这种零散的数值类型,同时也会出现属性引用缺失的问题。

2. 变量引用错误

循环代码里你用了${{ section.name }},但你的参数结构里根本没有name字段,应该引用的是section.module。

修正后的参数定义

parameters:
  - name: customers
    type: object
    default:
      - module: Warmup
        timeout: 20
      - module: Sidebar
        timeout: 15

修正后的循环任务代码

- ${{ each section in parameters.customers }}:
  - task: VSTest@3
    displayName: 'Testing - ${{ section.module }} '
    inputs:
      testAssemblyVer2: 'C:\Code\Release\net7.0\CodeRegression.dll'
      searchFolder: 'C:\Code\Release\net7.0\'
      testFiltercriteria: 'TestCategory=${{ section.module }}'
      testRunTitle: 'Regression ${{ section.module }}'
      platform: '$(buildPlatform)'
      configuration: '$(buildConfiguration)'
    continueOnError: true
    condition: succeededOrFailed()
    timeoutInMinutes: ${{ section.timeout }}

修正后,每个section都是完整的包含module和timeout的对象,timeout是标准整数类型,符合timeoutInMinutes的参数要求,同时变量引用也完全匹配结构定义。

内容的提问来源于stack exchange,提问作者Kev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 04:25:07