capture fail of migrate

This commit is contained in:
Trevor Batley 2023-06-05 14:54:51 +10:00
parent c9e3f1782c
commit ef23cc5f9a

View File

@ -162,8 +162,8 @@ if [[ "$SOURCEORG" == "smecontribs" ]]; then
fi fi
# migrate the source package over to target with updated fields # migrate the source package over to target with updated fields
if [ $DEBUG ] ; then echo "Migrating $SOURCEORG/$SOURCEPKG as $TARGETORG/$TRAGETPKG on $GITEAHOST" ; fi if [ $DEBUG ] ; then echo "Migrating $SOURCEORG/$SOURCEPKG as $TARGETORG/$TARGETPKG on $GITEAHOST" ; fi
RESPONSE=$(curl $SILENT $checkSSL -X 'POST' \ RESPONSE=$(curl $SILENT $checkSSL -o /dev/null -w "%{http_code}" -X 'POST' \
"$GITEAHOST/api/v1/repos/migrate" \ "$GITEAHOST/api/v1/repos/migrate" \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN" \ -H "Authorization: token $GITEAACCESSTOKEN" \
@ -176,6 +176,10 @@ RESPONSE=$(curl $SILENT $checkSSL -X 'POST' \
"repo_owner": "'"$TARGETORG"'" "repo_owner": "'"$TARGETORG"'"
}' }'
) )
if [[ $RESPONSE != 201 ]] ; then
echo "Unable to migrate $SOURCEORG/$SOURCEPKG to $TARGETORG/$TARGETPKG ($RESPOMNSE) - Aborting"
exit 1
fi
# Migrate does NOT copy accross the issues and wiki external links # Migrate does NOT copy accross the issues and wiki external links
# grab WIKILINK from source package # grab WIKILINK from source package
@ -325,7 +329,7 @@ if [ $TRANSFER ] ; then
# Transfer the package back to source organisation # Transfer the package back to source organisation
if [[ -z $EXISTS ]] ; then if [[ -z $EXISTS ]] ; then
if [ $DEBUG ] ; then echo "Acrtual Transfer" ; fi if [ $DEBUG ] ; then echo "Actual Transfer" ; fi
RESPONSE=$(curl "$SILENT" "$checkSSL" -o /dev/null -w "%{http_code}" -X 'POST' \ RESPONSE=$(curl "$SILENT" "$checkSSL" -o /dev/null -w "%{http_code}" -X 'POST' \
"$GITEAHOST/api/v1/repos/$TARGETORG/$TARGETPKG/transfer" \ "$GITEAHOST/api/v1/repos/$TARGETORG/$TARGETPKG/transfer" \
-H 'accept: application/json' \ -H 'accept: application/json' \