Az CLI:无法使用 运行 时间参数 运行 管道

Az CLI: Cannot run pipeline with runtime parameters

我正在尝试 运行 使用 AZ CLI 的管道。我有一个简单的管道:

parameters:
- name: initials
  displayName: Initials
  type: string

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
- script: echo ${{ parameters.initials }}
  displayName: Test

我尝试 运行 它使用:

az pipelines run --organization <my org> --project <my project> --name <pipeline> --branch <my branch> --debug --variables initials=maim

然后我得到一个错误:

ValidationResults":[{“result”:“error”,“message”:"A value for the parameter must be provided

这有点奇怪,因为您可以从调试中看出正在设置参数:

因为你需要发送 parameters 而你发送 variables.

根据this GitHub issue,它在新版本中修复了:

  1. 需要先删除旧包:
az extension remove -n azure-devops
az extension add --source https://github.com/roshan-sy/release-repo/releases/download/1/azure_devops-0.23.0-py2.py3-none-any.whl
  1. 初步测试看起来不错:
az login
az pipelines run --help
...
--parameters : Space separated "name=value" pairs for the parameters you would like to set.
...
az pipelines run --name "{pipeline.name}" --parameters Param1={Value1}