Commit 37e1a010 authored by canterburym's avatar canterburym
Browse files

Merge test script

parent 9882253d
Pipeline #3170 passed with stages
in 1 minute and 23 seconds
import os
import pprint
import requests
import json
print ("Hello world")
vars = os.environ
pprint.pprint(dict(vars))
crCommitBranch = os.environ.get("CI_COMMIT_REF_NAME", "cr/TS33128/0163")
apiUrl = os.environ.get("CI_API_V4_URL", "https://forge.3gpp.org/rep/api/v4")
projectId = os.environ.get("CI_PROJECT_ID", "13")
def gapi (query):
url = f"{apiUrl}/projects/{projectId}/{query}"
r = requests.get(url)
return json.loads(r.text)
print ("Searching for corresponding MR...")
mrs = gapi(f"merge_requests?source_branch={crCommitBranch}")
if len(mrs) == 0:
print ("No MR found... aborting")
exit()
if len(mrs) > 1:
print (f"{len(mrs)} MRs found, 1 expected - aborting")
exit(-1)
mr = mrs[0]
print (f"Found MR {mr['reference']} ({mr['title']})")
print (f"Target branch is {mr['target_branch']}")
print ("Searching for open MRs targeting same branch...")
mrs = gapi(f"merge_requests?target_branch={mr['target_branch']}&state=opened")
print (f"{len(mrs)} MRs found")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment