Start a build and passing variables through Azure DevOps Rest API

后端 未结 2 1770
孤独总比滥情好
孤独总比滥情好 2020-12-03 08:29

I would like to start a Azure Pipelines build through the REST API. There is an API for queuing builds but I couldn\'t find a way to define variables.

2条回答
  •  Happy的楠姐
    2020-12-03 09:02

    The accepted answer does not really answers the question when you need to set a value at queue time. The solution is actually pretty simple you just have to add a parameters field to the json payload. The content should be a json string (not directly an object) containing the parameters Ex :

    {
        "parameters":  "{\"ReleaseNumber\":  \"1.0.50\", \"AnotherParameter\":  \"a value\"}",
        "definition":  {
                           "id":  2
                       }
    }
    

    EDIT : This feature is now properly documented as an optional stringified dictionary. See https://www.visualstudio.com/fr-fr/docs/integrate/api/build/builds#queue-a-build

提交回复
热议问题