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 ...@@ -91,15 +91,28 @@ else
# shellcheck disable=SC2001 # shellcheck disable=SC2001
path="$(echo "$path" | sed -e 's,\..*,,g')" path="$(echo "$path" | sed -e 's,\..*,,g')"
gitlab 200 GET "projects?archived=0&search_namespaces=1&search=$path" gitlab 200 GET "projects?archived=0&search_namespaces=1&search=$path"
PRJID=$(echo "$result" | jq -r .[0]."id") i=0
if [[ "a${PRJID}a" == "aa" ]]; then while true
echo "No project found" do
exit 6 NAMESPACE=$(echo "$result" | jq -r .[$i]."path_with_namespace")
fi if [[ "$NAMESPACE" == "$path" ]]; then
if [[ $(isNumeric "$PRJID") -eq 1 ]]; then PRJID=$(echo "$result" | jq -r .[$i]."id")
echo "Can not find project ID" if [[ "a${PRJID}a" == "aa" ]]; then
exit 6 echo "No project found"
fi 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 fi
echo "Find pipeline trigger token ..." echo "Find pipeline trigger token ..."
......
...@@ -94,15 +94,28 @@ else ...@@ -94,15 +94,28 @@ else
# shellcheck disable=SC2001 # shellcheck disable=SC2001
path="$(echo "$path" | sed -e 's,\..*,,g')" path="$(echo "$path" | sed -e 's,\..*,,g')"
gitlab 200 GET "projects?search_namespaces=1&search=$path" gitlab 200 GET "projects?search_namespaces=1&search=$path"
PRJID=$(echo "$result" | jq -r .[0]."id") i=0
if [[ "a${PRJID}a" == "aa" ]]; then while true
echo "No project found" do
exit 6 NAMESPACE=$(echo "$result" | jq -r .[$i]."path_with_namespace")
fi if [[ "$NAMESPACE" == "$path" ]]; then
if [[ $(isNumeric "$PRJID") -eq 1 ]]; then PRJID=$(echo "$result" | jq -r .[$i]."id")
echo "Can not find project ID" if [[ "a${PRJID}a" == "aa" ]]; then
exit 6 echo "No project found"
fi 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 fi
echo "Create merge request ..." echo "Create merge request ..."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment