Skip to content
Snippets Groups Projects
Commit 495712fa authored by jurgenhaas's avatar jurgenhaas
Browse files

Merge branch 'develop' into 'main'

Merging develop into main

See merge request !6
parents 5810d09b 6c79bca9
No related branches found
No related tags found
1 merge request!6Merging develop into main
Pipeline #510681 passed
#!/bin/bash
function gitlab() {
EXPECTED=$1
METHOD=$2
REQUEST=$3
shift 3
echo " sending request ..."
output="$(curl --write-out "\nHTTP-Code:%{http_code}" -X "$2" -s -H "Private-Token: ${GITLAB_PRIVATE_TOKEN}" "${GITLAB_URL}"/api/v4/"$3" "$@")"
output="$(curl --write-out "\nHTTP-Code:%{http_code}" -X "$METHOD" -s -H "Private-Token: ${GITLAB_PRIVATE_TOKEN}" "${GITLAB_URL}"/api/v4/"$REQUEST" "$@")"
echo " done"
result="$(echo "$output" | grep "{")"
code="$(echo "$output" | grep -m 1 "HTTP-Code:" | cut -d: -f2)"
if [[ $code -eq $1 ]]; then
if [[ $code -eq $EXPECTED ]]; then
return
fi
echo "$2 request to $3 did not succeed! Responds with code $code instead of $1"
echo "$METHOD request to $REQUEST did not succeed! Responds with code $code instead of $EXPECTED"
exit 99
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment