baby frontend soundin good

This commit is contained in:
Bel LaPointe
2022-02-08 09:39:20 -07:00
parent 3a246f8b38
commit d01a933b73
4 changed files with 63 additions and 4 deletions

View File

@@ -37,11 +37,16 @@ gitlab() (
local url="$1"
local url_path="${url#http*://gitlab*.net/}"
local project="${url_path%%/-/*}"
local project="${project%%/tree/*}"
local root="${url_path#*$project}"
local root="${root#*/-/}"
local root="${root#tree/}"
local root="${root#blob/}"
local root="${root#*/}"
local root="${root#*/-}"
if [ "$root" != "${root#/tree}" ]; then
root="${root#/tree}"
root="/${root#/*/}"
fi
local root="${root#/blob}"
local root="${root#/}"
log project=$project, root=$root, url=$url
echo "$project"
echo "$root"
}

View File

@@ -47,6 +47,9 @@ EOF
}
test_url_to_project_root() {
gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/tree/master | grep -q '^data-store/orchestration/runbooks$'
gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/tree/master | tail -n 1 | grep ^$
gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/-/blob/master/Alerts/rems/README.md | grep -q 'data-store/orchestration/runbooks'
gitlab _url_to_project_root https://gitlab-app.eng.qops.net/data-store/orchestration/runbooks/-/blob/master/Alerts/rems/README.md | grep -q 'Alerts/rems/README.md'

View File

@@ -44,6 +44,7 @@ each() {
source ./cache.sh
set -e
set -o pipefail
log() { echo "> $*" >&2; }
}
if [ "$0" == "$BASH_SOURCE" ]; then