Skip to content
Snippets Groups Projects
Commit 5943c91c authored by jurgenhaas's avatar jurgenhaas
Browse files

Fix finding project ID from project namespace to avoid conflicts with matching substrings

parent c99aad51
No related branches found
No related tags found
1 merge request!24Fix finding project ID from project namespace to avoid conflicts with matching substrings
......@@ -91,15 +91,28 @@ else
# shellcheck disable=SC2001
path="$(echo "$path" | sed -e 's,\..*,,g')"
gitlab 200 GET "projects?archived=0&search_namespaces=1&search=$path"
PRJID=$(echo "$result" | jq -r .[0]."id")
if [[ "a${PRJID}a" == "aa" ]]; then
echo "No project found"
exit 6
fi
if [[ $(isNumeric "$PRJID") -eq 1 ]]; then
echo "Can not find project ID"
exit 6
fi
i=0
while true
do
NAMESPACE=$(echo "$result" | jq -r .[$i]."path_with_namespace")
if [[ "$NAMESPACE" == "$path" ]]; then
PRJID=$(echo "$result" | jq -r .[$i]."id")
if [[ "a${PRJID}a" == "aa" ]]; then
echo "No project found"
exit 6
fi
if [[ $(isNumeric "$PRJID") -eq 1 ]]; then
echo "Can not find project ID"
exit 6
fi
break
fi
if [[ "a${NAMESPACE}a" == "aa" ]]; then
echo "No project found"
exit 6
fi
((i=i+1))
done
fi
echo "Find pipeline trigger token ..."
......
......@@ -94,15 +94,28 @@ else
# shellcheck disable=SC2001
path="$(echo "$path" | sed -e 's,\..*,,g')"
gitlab 200 GET "projects?search_namespaces=1&search=$path"
PRJID=$(echo "$result" | jq -r .[0]."id")
if [[ "a${PRJID}a" == "aa" ]]; then
echo "No project found"
exit 6
fi
if [[ $(isNumeric "$PRJID") -eq 1 ]]; then
echo "Can not find project ID"
exit 6
fi
i=0
while true
do
NAMESPACE=$(echo "$result" | jq -r .[$i]."path_with_namespace")
if [[ "$NAMESPACE" == "$path" ]]; then
PRJID=$(echo "$result" | jq -r .[$i]."id")
if [[ "a${PRJID}a" == "aa" ]]; then
echo "No project found"
exit 6
fi
if [[ $(isNumeric "$PRJID") -eq 1 ]]; then
echo "Can not find project ID"
exit 6
fi
break
fi
if [[ "a${NAMESPACE}a" == "aa" ]]; then
echo "No project found"
exit 6
fi
((i=i+1))
done
fi
echo "Create merge request ..."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment