Skip to content

Commit 751e5c8

Browse files
Add Windows sign.sh retry and check curl rc (#3490)
* 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]>
1 parent 5f79368 commit 751e5c8

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

sign.sh

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,32 @@ signRelease()
8383
dir=$(dirname "$f")
8484
file=$(basename "$f")
8585
mv "$f" "${dir}/unsigned_${file}"
86-
curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" https://cbi.eclipse.org/authenticode/sign
86+
if ! curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" https://cbi.eclipse.org/authenticode/sign; then
87+
echo "curl command failed, sign of $f failed"
88+
89+
# Retry up to 20 times
90+
max_iterations=20
91+
iteration=1
92+
success=false
93+
echo "Code Not Signed For File $f"
94+
while [ $iteration -le $max_iterations ] && [ $success = false ]; do
95+
echo $iteration Of $max_iterations
96+
sleep 1
97+
if ! curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" https://cbi.eclipse.org/authenticode/sign; then
98+
echo "curl command failed, $f Failed Signing On Attempt $iteration"
99+
success=false
100+
iteration=$((iteration+1))
101+
if [ $iteration -gt $max_iterations ]
102+
then
103+
echo "Errors Encountered During Signing"
104+
exit 1
105+
fi
106+
else
107+
echo "$f Signed OK On Attempt $iteration"
108+
success=true
109+
fi
110+
done
111+
fi
87112
chmod --reference="${dir}/unsigned_${file}" "$f"
88113
rm -rf "${dir}/unsigned_${file}"
89114
else
@@ -132,9 +157,13 @@ signRelease()
132157
dir=$(dirname "$f")
133158
file=$(basename "$f")
134159
mv "$f" "${dir}/unsigned_${file}"
135-
curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" -F entitlements="@$ENTITLEMENTS" https://cbi.eclipse.org/macos/codesign/sign
136-
echo File = "$f"
137-
TESTMACSIGN=$(grep -ic "$MACSIGNSTRING" "$f")
160+
if ! curl --fail --silent --show-error -o "$f" -F file="@${dir}/unsigned_${file}" -F entitlements="@$ENTITLEMENTS" https://cbi.eclipse.org/macos/codesign/sign; then
161+
echo "curl command failed, sign of $f failed"
162+
TESTMACSIGN=0
163+
else
164+
echo File = "$f"
165+
TESTMACSIGN=$(grep -ic "$MACSIGNSTRING" "$f")
166+
fi
138167
echo Sign Result = "$TESTMACSIGN"
139168
if [ "$TESTMACSIGN" -gt 0 ]
140169
then
@@ -149,9 +178,13 @@ signRelease()
149178
while [ $iteration -le $max_iterations ] && [ $success = false ]; do
150179
echo $iteration Of $max_iterations
151180
sleep 1
152-
curl --fail -o "$f" -F file="@${dir}/unsigned_${file}" -F entitlements="@$ENTITLEMENTS" https://cbi.eclipse.org/macos/codesign/sign
153-
TESTMACSIGN2=$(grep -ic "$MACSIGNSTRING" "$f")
154-
echo TESTMACSIGN2 = "$TESTMACSIGN2"
181+
if ! curl --fail -o "$f" -F file="@${dir}/unsigned_${file}" -F entitlements="@$ENTITLEMENTS" https://cbi.eclipse.org/macos/codesign/sign; then
182+
echo "curl command failed, sign of $f failed"
183+
TESTMACSIGN2=0
184+
else
185+
TESTMACSIGN2=$(grep -ic "$MACSIGNSTRING" "$f")
186+
echo TESTMACSIGN2 = "$TESTMACSIGN2"
187+
fi
155188
if [ "$TESTMACSIGN2" -gt 0 ]
156189
then
157190
echo "$f Signed OK On Attempt $iteration"

0 commit comments

Comments
 (0)