`merge_status` is inconsistent across different users and does not refresh on API request
Depending on token, different results are returned for merge_status.
Also, with_merge_status_recheck sometimes seems to have no effect.
ticket
https://gitlab.zendesk.com/agent/tickets/298058 (internal link only)
output from below script using various tokens:
token:{token} token:{my token}
id: 8784 status: can_be_merged id: 8756 status: can_be_merged
id: 8783 status: can_be_merged id: 8745 status: can_be_merged
id: 8782 status: can_be_merged id: 8744 status: cannot_be_merged
id: 8780 status: can_be_merged id: 8743 status: can_be_merged
id: 8779 status: can_be_merged id: 8722 status: can_be_merged
id: 8778 status: can_be_merged id: 8679 status: can_be_merged
id: 8777 status: can_be_merged token:{generic token}
id: 8776 status: can_be_merged id: 8756 status: checking
id: 8774 status: can_be_merged id: 8745 status: can_be_merged
id: 8773 status: can_be_merged id: 8744 status: checking
id: 8772 status: can_be_merged id: 8743 status: can_be_merged
id: 8771 status: can_be_merged id: 8722 status: can_be_merged
id: 8770 status: can_be_merged id: 8679 status: can_be_merged
id: 8769 status: can_be_merged >>> # just one
id: 8765 status: can_be_merged >>> ID='/8744'
id: 8760 status: can_be_merged >>> for token in my_token, gen_token:
id: 8748 status: can_be_merged ... print("token:{token}")
id: 8745 status: can_be_merged ... headers = {**({}),
id: 8744 status: checking ... 'Private-Token': token,
id: 8742 status: checking ... 'pagination': 'keyset'}
id: 8713 status: can_be_merged ... url= GL_URL + MRS + ID
id: 8679 status: can_be_merged ... resp = getattr(requests, verb.lower())(url,headers=headers)
id: 8642 status: checking ... body = json.loads(resp.text)
id: 8744 status: cannot_be_merged ... for mr in [body]:
id: 8742 status: cannot_be_merged ... print(f"id: {mr['iid']} status: {mr['merge_status']}")
id: 8642 status: cannot_be_merged ...
token:{token}
id: 8744 status: cannot_be_merged
token:{token}
id: 8744 status: cannot_be_merged
customer python script used to test inconsistency
import requests
ENT_PROJ_ID = 4124
GL_URL = "https://cloudlab.us.oracle.com/api/v4"
MRS = f'/projects/{ENT_PROJ_ID}/merge_requests'
ID = '/8744'
params = {'state': 'opened', 'with_merge_status_recheck': 'true'}
my_token = 'XXX'
gen_token = 'YYY'
verb="GET"
for token in my_token, gen_token:
print("token:{token}")
headers = {**({}),
'Private-Token': token,
'pagination': 'keyset'}
url= GL_URL + MRS
resp = getattr(requests, verb.lower())(url,headers=headers, params=params )
body = json.loads(resp.text)
while 'next' in resp.links:
resp = getattr(requests, verb.lower())(resp.links['next']['url'], params=params, headers=headers)
d = json.loads(resp.text)
if type(d) is list:
body.extend(d)
else:
body.update(d)
for mr in body:
print(f"id: {mr['iid']} status: {mr['merge_status']}")
Edited by Lewis Brown