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

Check notarize-service curl RC and output failure response #775

Merged
merged 2 commits into from
Nov 22, 2023
Merged
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
17 changes: 14 additions & 3 deletions codesign/eclipse-notarize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,24 @@
# limitations under the License.
################################################################################

set -eu

PKG="$1"
PRIMARY_BUNDLE_ID="$2"

echo "Notarizing $1, this can take a while! Updating status every minute..."

RESPONSE=$(curl -s -X POST -F file=@${PKG} -F 'options={"primaryBundleId": "'${PRIMARY_BUNDLE_ID}'", "staple": true};type=application/json' https://cbi.eclipse.org/macos/xcrun/notarize)
RESPONSE=$(curl -s -X POST -F file=@${PKG} -F 'options={"primaryBundleId": "'${PRIMARY_BUNDLE_ID}'", "staple": true};type=application/json' https://cbi.eclipse.org/macos/xcrun/notarize 2>&1)
CURL_RC=$?
if [ $CURL_RC -ne 0 ]; then
echo "Notarize service curl failed rc=$CURL_RC"
echo "$RESPONSE"
exit $CURL_RC
fi

UUID=$(echo $RESPONSE | grep -Po '"uuid"\s*:\s*"\K[^"]+')
STATUS=$(echo $RESPONSE | grep -Po '"status"\s*:\s*"\K[^"]+')

while [[ ${STATUS} == 'IN_PROGRESS' ]]; do
echo "Waiting for notarize service response..."
sleep 1m
RESPONSE=$(curl -s https://cbi.eclipse.org/macos/xcrun/${UUID}/status)
STATUS=$(echo $RESPONSE | grep -Po '"status"\s*:\s*"\K[^"]+')
Expand All @@ -40,3 +45,9 @@ if [[ ${STATUS} != 'COMPLETE' ]]; then
fi

curl -o "$PKG" https://cbi.eclipse.org/macos/xcrun/${UUID}/download
CURL_RC=$?
if [ $CURL_RC -ne 0 ]; then
echo "curl download of notarized pkg failed, failed rc=$CURL_RC"
exit $CURL_RC
fi