Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jenkins 如何使用BitBucket API获取PR的构建状态?_Jenkins_Bitbucket_Github Api_Bitbucket Server_Bitbucket Api - Fatal编程技术网

Jenkins 如何使用BitBucket API获取PR的构建状态?

Jenkins 如何使用BitBucket API获取PR的构建状态?,jenkins,bitbucket,github-api,bitbucket-server,bitbucket-api,Jenkins,Bitbucket,Github Api,Bitbucket Server,Bitbucket Api,对任何拉取请求使用Bitbucket API时,未获取生成作业详细信息/PR状态 以下是我的API URL: https://example.com/rest/api/1.0/projects/{projectkey}/repos/{reposlug}/pull-requests/{pullrequestID} GUI上的生成状态如何: 我还尝试了以下方法来获得构建状态,但没有成功 /rest/api/1.0/projects/{projectKey}/repos/{repositorySl

对任何拉取请求使用Bitbucket API时,未获取生成作业详细信息/PR状态

以下是我的API URL:

https://example.com/rest/api/1.0/projects/{projectkey}/repos/{reposlug}/pull-requests/{pullrequestID}
GUI上的生成状态如何:

我还尝试了以下方法来获得构建状态,但没有成功

/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks
所以我想知道,任何公关的构建状态是成功还是失败


提前感谢您的回答。

构建状态在提交上,而不是在PR上。首先,您应该通过调用
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull requests/{pullRequestId}
找到源分支的最新提交。有关更多详细信息,请参阅

拥有提交id后,可以通过调用
/rest/build status/1.0/commits/{commitId}
查询生成状态api。有关使用API 2.0的更多详细信息,请参见

  • 获取状态:
  • 设置状态:
例如:

curl——请求获取\
--网址https://api.bitbucket.org/2.0/repositories/piavita/com.piavita-vet.ios/pullrequests/300/statuses \
--标题“授权:基本加密密钥”\
--标题“内容类型:应用程序/json”
curl --request POST \
  --url https://api.bitbucket.org/2.0/repositories/piavita/com.piavita-vet.ios/commit/8619291af393/statuses/build \
  --header 'Authorization: Basic SecretKey' \
  --header 'Connection: keep-alive' \
  --data '{\n   "url": "http://jenkins.ddns.net:8080/job/jobName/123/",\n   "state": "SUCCESSFUL",\n    "key": "JENKINS"\n}'