Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPS-141-v11 #8

Open
wants to merge 1 commit into
base: REL-11
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 40 additions & 9 deletions resources/notarize_apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,55 @@ if [ "${package_name##*.}" = "dmg" ]; then
security unlock-keychain -p $KEYCHAIN_PASSWD ~/Library/Keychains/login.keychain;codesign --verbose --verify --deep -f -i 'com.edb.postgresql' -s 'Developer ID Application: EnterpriseDB Corporation' --options runtime $package_name || _die "Failed to codesign $package_name"
echo "$package_name Code signed done successfully"
fi
requestUUID=$(xcrun altool --notarize-app -f $package_name --asc-provider $dev_asc_provider --primary-bundle-id $dev_primary_bundle_id -u $dev_account -p "@keychain:${dev_password_keychain_name}" 2>&1 | awk '/RequestUUID/ { print $NF; }')

cmd_status=0
for i in {1..3}; do
echo "Trying attempt ($i/3) to upload/notarize $package_name file .. "
notarize_app=$(xcrun altool --notarize-app -f $package_name --asc-provider $dev_asc_provider --primary-bundle-id $dev_primary_bundle_id -u $dev_account -p "@keychain:${dev_password_keychain_name}" 2>&1 | awk '/RequestUUID/ { print $NF; }')
if [ $cmd_status != 0 ]; then
# Due to network latency or any other network issue if it fails
# then we need to retry at least 3 times
# notarize_app will contain error details
echo "## $notarize_app"
else
# No need to retry again - it is sucessfully uploaded
break;
fi
done
# print error if above command fails
if [ $cmd_status != 0 ]; then
echo "## could not upload for notarization"
exit 1
fi
requestUUID=$notarize_app
if [[ $requestUUID == "" ]]; then
echo "ERROR:could not upload for notarization"
exit 1
fi

echo "Notarization RequestUUID: $requestUUID"

# wait for status to be not "in progress" any more
request_status="in progress"
while [[ "$request_status" == "in progress" ]]; do
echo "waiting... "
sleep 30
request_status=$(requeststatus "$requestUUID")
echo "request_status = $request_status"
done
# some time request_status gets empty status in between while fatching notarization-info
# so we need to atleast try 10 time to avoid daily build failure
# if everything is successful then we can break the loop
for i in {1..10}; do
echo "Trying attempt ($i/10) to get notarize information .. "

# wait for status to be not "in progress" any more
request_status="in progress"
while [[ "$request_status" == "in progress" ]]; do
echo "waiting... "
sleep 30
request_status=$(requeststatus "$requestUUID")
echo "request_status = $request_status"
done

# exit the loop if return status is success
if [[ $request_status == "success" ]]; then
break
fi

done
# print status information
xcrun altool --notarization-info $requestUUID \
--username $dev_account \
Expand Down