Azure DevOps YAML Pipeline Parameters Not Working from REST API Trigger

后端 未结 2 2146
时光取名叫无心
时光取名叫无心 2021-02-16 00:16

I\'m trying to create a YAML based pipeline that takes a parameter, then trigger the pipeline to run from a Azure DevOps REST API. I\'m able to see the build gets queued, but th

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-16 00:56

    Got the solution after spending 2 to 3 Hour:

    https://dev.azure.com/{organization}/{project}/_apis/pipelines/2/runs?api-version=6.0-preview.1
    
       Where 2= {pipelineId}
    

    Header :

    Authorization: Personal access token. Use any value for the user name and the token as the password.
    Type: basic
    
    Content-Type : application/json
    Accept : application/json
    

    Right Now I'm using: Postman for testing this API So sharing posting main screenshot:

    In the Body part :

    {"previewRun":false,"stagesToSkip": [],"resources": {"repositories": {"self": {"refName": "refs/heads/master"}}},"templateParameters": {"testParam": "rawat Rob" },"variables": {}}
    
    previewRun :{If true, don't actually create a new run. Instead, return the final YAML document after parsing templates.}
    

    It is working for me And having test around 5 to 7 time

提交回复
热议问题