Skip to content

Commit

Permalink
Add Windows sign.sh retry and check curl rc (#3490)
Browse files Browse the repository at this point in the history
* Add Windows sign.sh retry and check curl rc

Signed-off-by: Andrew Leonard <[email protected]>

* Add Windows sign.sh retry and check curl rc

Signed-off-by: Andrew Leonard <[email protected]>

---------

Signed-off-by: Andrew Leonard <[email protected]>
  • Loading branch information
andrew-m-leonard authored Oct 2, 2023
1 parent 5f79368 commit 751e5c8
Showing 1 changed file with 40 additions and 7 deletions.
47 changes: 40 additions & 7 deletions sign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,32 @@ signRelease()
dir=$(dirname "$f")
file=$(basename "$f")
mv "$f" "${dir}/unsigned_${file}"
curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" https://cbi.eclipse.org/authenticode/sign
if ! curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" https://cbi.eclipse.org/authenticode/sign; then
echo "curl command failed, sign of $f failed"

# Retry up to 20 times
max_iterations=20
iteration=1
success=false
echo "Code Not Signed For File $f"
while [ $iteration -le $max_iterations ] && [ $success = false ]; do
echo $iteration Of $max_iterations
sleep 1
if ! curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" https://cbi.eclipse.org/authenticode/sign; then
echo "curl command failed, $f Failed Signing On Attempt $iteration"
success=false
iteration=$((iteration+1))
if [ $iteration -gt $max_iterations ]
then
echo "Errors Encountered During Signing"
exit 1
fi
else
echo "$f Signed OK On Attempt $iteration"
success=true
fi
done
fi
chmod --reference="${dir}/unsigned_${file}" "$f"
rm -rf "${dir}/unsigned_${file}"
else
Expand Down Expand Up @@ -132,9 +157,13 @@ signRelease()
dir=$(dirname "$f")
file=$(basename "$f")
mv "$f" "${dir}/unsigned_${file}"
curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" -F entitlements="@$ENTITLEMENTS" https://cbi.eclipse.org/macos/codesign/sign
echo File = "$f"
TESTMACSIGN=$(grep -ic "$MACSIGNSTRING" "$f")
if ! curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" -F entitlements="@$ENTITLEMENTS" https://cbi.eclipse.org/macos/codesign/sign; then
echo "curl command failed, sign of $f failed"
TESTMACSIGN=0
else
echo File = "$f"
TESTMACSIGN=$(grep -ic "$MACSIGNSTRING" "$f")
fi
echo Sign Result = "$TESTMACSIGN"
if [ "$TESTMACSIGN" -gt 0 ]
then
Expand All @@ -149,9 +178,13 @@ signRelease()
while [ $iteration -le $max_iterations ] && [ $success = false ]; do
echo $iteration Of $max_iterations
sleep 1
curl --fail -o "$f" -F file="@${dir}/unsigned_${file}" -F entitlements="@$ENTITLEMENTS" https://cbi.eclipse.org/macos/codesign/sign
TESTMACSIGN2=$(grep -ic "$MACSIGNSTRING" "$f")
echo TESTMACSIGN2 = "$TESTMACSIGN2"
if ! curl --fail -o "$f" -F file="@${dir}/unsigned_${file}" -F entitlements="@$ENTITLEMENTS" https://cbi.eclipse.org/macos/codesign/sign; then
echo "curl command failed, sign of $f failed"
TESTMACSIGN2=0
else
TESTMACSIGN2=$(grep -ic "$MACSIGNSTRING" "$f")
echo TESTMACSIGN2 = "$TESTMACSIGN2"
fi
if [ "$TESTMACSIGN2" -gt 0 ]
then
echo "$f Signed OK On Attempt $iteration"
Expand Down

0 comments on commit 751e5c8

Please sign in to comment.