Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SA3
SA3LI Trial
Commits
37e1a010
Commit
37e1a010
authored
Apr 06, 2021
by
canterburym
Browse files
Merge test script
parent
9882253d
Pipeline
#3170
passed with stages
in 1 minute and 23 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
testing/merge_test.py
testing/merge_test.py
+32
-2
No files found.
testing/merge_test.py
View file @
37e1a010
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"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment