Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
docker-ci
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
UNL ITS
docker-ci
Commits
35a541de
Commit
35a541de
authored
8 months ago
by
Alan Nelson
Browse files
Options
Downloads
Patches
Plain Diff
Integrate new bash script into approval check flow
parent
14abc16b
No related branches found
No related tags found
3 merge requests
!94
Merge Request Check Updates
,
!93
Integrate bash script
,
!91
New Merge Request Helper
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
merge-request-check/Dockerfile
+3
-0
3 additions, 0 deletions
merge-request-check/Dockerfile
merge-request-check/approval_check.py
+15
-2
15 additions, 2 deletions
merge-request-check/approval_check.py
merge-request-check/merge_review_check.sh
+3
-0
3 additions, 0 deletions
merge-request-check/merge_review_check.sh
with
21 additions
and
2 deletions
merge-request-check/Dockerfile
+
3
−
0
View file @
35a541de
...
...
@@ -14,9 +14,12 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
RUN
mkdir
/code
WORKDIR
/code
RUN
apk add
--no-cache
bash git
COPY
requirements.txt ./
RUN
pip
install
--no-cache-dir
-r
requirements.txt
COPY
approval_check.py ./
COPY
merge_review_check.sh ./
CMD
["python", "approval_check.py"]
This diff is collapsed.
Click to expand it.
merge-request-check/approval_check.py
+
15
−
2
View file @
35a541de
import
os
import
requests
import
subprocess
import
sys
'''
...
...
@@ -18,11 +19,23 @@ response = requests.post('https://its-lampprod1-whm.unl.edu/merge_auth_check.php
'
user
'
:
os
.
environ
.
get
(
'
GITLAB_USER_LOGIN
'
)
})
if
(
response
.
status_code
==
200
)
:
if
response
.
status_code
==
200
:
# Merge is allowed, print response and exit cleanly (status 0)
print
(
response
.
content
.
decode
(
'
utf-8
'
))
exit
(
0
)
elif
response
.
status_code
==
403
:
# Merge is not allowed, run further checks to see if a review is needed.
result
=
subprocess
.
run
([
'
bash
'
,
'
/code/merge_review_check.sh
'
],
capture_output
=
True
,
text
=
True
)
# Print output from additional checks script
print
(
result
.
stdout
)
print
(
result
.
stderr
,
file
=
sys
.
stderr
)
# Exit using the exit code form the check script
exit
(
result
.
returncode
)
else
:
# Merge is not allowed, print response and exit with an error (status 1)
# API call failed. Server may be down, or other setup failure. Exit with an error (status 1)
print
(
'
Merge request approval check API call failed
'
)
print
(
f
'
API Call Status Code:
{
response
.
status_code
}
'
)
print
(
response
.
content
.
decode
(
'
utf-8
'
),
file
=
sys
.
stderr
)
exit
(
1
)
This diff is collapsed.
Click to expand it.
merge-request-check/merge_review_check.sh
+
3
−
0
View file @
35a541de
...
...
@@ -6,6 +6,9 @@
#CI_COMMIT_BEFORE_SHA=""
#CI_COMMIT_SHA=""
# If any commands in this scprt fail, exit with a non-zero exit code
set
-e
# Function to check for ASP.NET controls and directives
check_aspx
()
{
local
content
=
"
$1
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment