mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-05 21:12:52 +00:00
ci: add gitlab visual review to MRs
This commit is contained in:
@@ -105,6 +105,7 @@ executable:
|
|||||||
review:
|
review:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
script:
|
||||||
|
- .gitlab/ci/enableGitlabReviewToolbar.sh www/index.html "$CI_PROJECT_ID" "$CI_OPEN_MERGE_REQUESTS"
|
||||||
- ./node_modules/.bin/surge -p ./www -d https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
|
- ./node_modules/.bin/surge -p ./www -d https://$CI_PROJECT_PATH_SLUG-$CI_ENVIRONMENT_SLUG.surge.sh/
|
||||||
environment:
|
environment:
|
||||||
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
|
name: review/$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_NAME
|
||||||
@@ -112,6 +113,9 @@ review:
|
|||||||
on_stop: stop_review
|
on_stop: stop_review
|
||||||
tags:
|
tags:
|
||||||
- secrecy
|
- secrecy
|
||||||
|
except:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
|
||||||
stop_review:
|
stop_review:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
|||||||
12
.gitlab/ci/enableGitlabReviewToolbar.sh
Executable file
12
.gitlab/ci/enableGitlabReviewToolbar.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Adds a preedefined script tag including the merge current request id to the angular web app index.html.
|
||||||
|
# This enables the interactive gitlab review toolbar.
|
||||||
|
|
||||||
|
MERGE_REQUEST_ID=""
|
||||||
|
if echo -n $3 | grep -Eq '[0-9]+$'; then
|
||||||
|
MERGE_REQUEST_ID="$(echo -n "$3" | grep -Eo '[0-9]+$')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT_TAG="<script defer data-project-id=\"$2\" data-project-path=\"openstapps/app\" data-merge-request-id=\"$MERGE_REQUEST_ID\" data-mr-url=\"https://gitlab.com\" id=\"review-app-toolbar-script\" src=\"https://gitlab.com/assets/webpack/visual_review_toolbar.js\"></script>"
|
||||||
|
sed -i -e "\@</head>@i\\$SCRIPT_TAG" $1
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# script returns semantical versioning string linke 2.0.0 (if $1 is v2.0.0) or $1
|
# script returns semantical versioning string like 2.0.0 (if $1 is v2.0.0) or $1
|
||||||
if echo -n $1 | grep -Eq 'v[0-9]+\.[0-9]+\.[0-9]+'; then
|
if echo -n $1 | grep -Eq 'v[0-9]+\.[0-9]+\.[0-9]+'; then
|
||||||
echo $(echo -n "$1" | cut -c 2-);
|
echo $(echo -n "$1" | cut -c 2-);
|
||||||
else
|
else
|
||||||
echo $1;
|
echo $1;
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user