Trigger another build exist in project in Azure Devops

后端 未结 4 2063
暖寄归人
暖寄归人 2021-01-28 13:52

I have a repo name called A with its build pipeline as azure-pipelines.yml Then I have another repo called B with its build pipeline as

4条回答
  •  Happy的楠姐
    2021-01-28 14:22

    After a lot of struggle and the help of wise people here I finally manage to tame the issue. I'm posting here so that anyone can take a referebce. This is working now refer: ListBuild and QueueTheBuild

    name="ProjectA"
        curl --silent -X GET -H "Authorization:Bearer $(System.AccessToken)" -H "Content-Type:application/json"  $(System.TeamFoundationCollectionUri)/$(System.TeamProject)/_apis/build/definitions?api-version=6.0 --output /tmp/response.json
        #Now get the build-id of your project you are interested in
        #please be aware that api-version > 6 has different json output and below command 
        #may not help you to give the right id
        id=$(cat /tmp/response.json | jq -r --arg key ${name} '.value[] | select(.name==$key)| .id'  --raw-output)
        #create your body to post
        generate_post_data()
        {
          cat <

提交回复
热议问题