mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 02:10:09 +01:00
release: fix validation of gitlab token
If the token is wrong or expired, the command still returns
success. Check the content of the reply instead.
Fixes: f05192ada8 ('release.sh: release to freedesktop.org, not to GNOME')
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2148
This commit is contained in:
parent
ea0be49451
commit
481afec6ea
1 changed files with 6 additions and 4 deletions
|
|
@ -559,9 +559,11 @@ if [[ $GITLAB_TOKEN == "" ]]; then
|
|||
fi
|
||||
|
||||
# This step is not necessary for authentication, we use it only to provide a meaningful error message.
|
||||
curl --request GET --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
|
||||
"https://gitlab.freedesktop.org/api/v4/personal_access_tokens/self" &>/dev/null \
|
||||
|| die "failed to authenticate at gitlab.freedesktop.org with the private token"
|
||||
GITLAB_USER_ID=$(curl --request GET --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
|
||||
"https://gitlab.freedesktop.org/api/v4/personal_access_tokens/self" 2>/dev/null | jq ".user_id" || true)
|
||||
if [ -z "$GITLAB_USER_ID" ] || [ "$GITLAB_USER_ID" = "null" ]; then
|
||||
die "failed to authenticate to gitlab.freedesktop.org with the private token"
|
||||
fi
|
||||
|
||||
do_command git push "$ORIGIN" "${BRANCHES[@]}" || die "failed to to push branches ${BRANCHES[@]} to $ORIGIN"
|
||||
|
||||
|
|
@ -640,4 +642,4 @@ fi
|
|||
|
||||
if [[ $CREATE_RELEASE_FAIL == 1 ]]; then
|
||||
die "failed creating the release at gitlab.freedesktop.org. This was the last step, create it manually from the web UI"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue