I need to trigger a pull request pipeline. First, I get a list of open pull requests by
/2.0/repositories/{workspace}/{repo_slug}/pullrequests?state=OPEN
And then in loop I put necessary information from response to payload for triggering a pull request pipeline
issues = json.loads(getResponse.text)['values']
for issue in issues:
id=issue['id']
source = issue['source']
destination = issue['destination']
payload=json.dumps({
"target": {
"type": "pipeline_pullrequest_target",
"source": "pull-request-branch",
"destination": destination['branch']['name'],
"destination_commit": {
"hash" : destination['commit']['hash']
},
"commit": {
"hash" : source['commit']['hash']
},
"pullrequest" : {
"id" : str(id)
},
"selector": {
"type": "pull-requests",
"pattern": "VR-*"
}
}
})
So, my payload is like:
{
"target": {
"commit": {
"hash": "311349281708"
},
"destination": "develop",
"destination_commit": {
"hash": "c6da67fa6551"
},
"pullrequest": {
"id": "66"
},
"selector": {
"pattern": "VR-*",
"type": "pull-requests"
},
"source": "pull-request-branch",
"type": "pipeline_pullrequest_target"
}
}
I send it by
/2.0/repositories/{workspace}/{repo_slug}/pipelines/
And in response I get:
"error": {
"data": {
"arguments": {},
"key": "result-service.pipeline.yml-not-found"
},
"detail": "bitbucket-pipelines.yml not found.",
"message": "Bad request"
}
My bitbucket-pipelines.yml is :
pull-requests:
VR-*:
- step: *quality-gate-setup
- step: *quality-gate-run
VRS-*:
- step: *quality-gate-setup
- step: *quality-gate-run
release-*:
- step: *quality-gate-setup
- step: *quality-gate-run
Hi!
Which headers do you send?
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.