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

Improve Resilience Of Signing Checks For MacOS #3431

Merged
merged 33 commits into from
Jul 12, 2023
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
770024f
Improve codesigning
steelhead31 Jul 11, 2023
8a40500
Retry zip signing.
steelhead31 Jul 11, 2023
3fac0a9
Add debug
steelhead31 Jul 11, 2023
af334ca
Fix formatting.
steelhead31 Jul 11, 2023
7d8f13b
Fix case of variables.
steelhead31 Jul 11, 2023
dd30b50
Fix errcount check
steelhead31 Jul 11, 2023
04ab9a8
Add retry logic for zip signing
steelhead31 Jul 12, 2023
7b7574d
fix syntax error
steelhead31 Jul 12, 2023
56ca38d
Debugging zip signing
steelhead31 Jul 12, 2023
07597a7
Debugging
steelhead31 Jul 12, 2023
02fb4b1
Debug zip signing
steelhead31 Jul 12, 2023
b3db87b
Debug zip file signing
steelhead31 Jul 12, 2023
a3a1f48
Debug zip signing
steelhead31 Jul 12, 2023
1a73c38
Debug zip signing
steelhead31 Jul 12, 2023
c11a2ad
Fix zip signing check
steelhead31 Jul 12, 2023
3e9d90b
Fix zip signing test
steelhead31 Jul 12, 2023
12f6b51
Fix zip file name
steelhead31 Jul 12, 2023
62e5ba9
Debug zip sign checks
steelhead31 Jul 12, 2023
818f95d
Debug zip signing
steelhead31 Jul 12, 2023
0224e80
Debug zip signing
steelhead31 Jul 12, 2023
33d077f
Debugging Zip Signing
steelhead31 Jul 12, 2023
049c45b
Remove zip signing check with strings
steelhead31 Jul 12, 2023
67de2eb
Remove debugs
steelhead31 Jul 12, 2023
0e8d1f5
Linter fixes.
steelhead31 Jul 12, 2023
94a9c80
Linter fix
steelhead31 Jul 12, 2023
94eee20
Fix formatting
steelhead31 Jul 12, 2023
18e8e16
Linter fix
steelhead31 Jul 12, 2023
e63e2fe
Linter fixes
steelhead31 Jul 12, 2023
28eb7ae
Linter fixes
steelhead31 Jul 12, 2023
3e30b8c
Linter fix
steelhead31 Jul 12, 2023
7a7ab22
Linter fixes
steelhead31 Jul 12, 2023
c8c2736
Fix unbound var
steelhead31 Jul 12, 2023
bc585bb
Fix exit loop
steelhead31 Jul 12, 2023
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
45 changes: 42 additions & 3 deletions sign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ signRelease()
echo "Signing OSX release"

ENTITLEMENTS="$WORKSPACE/entitlements.plist"

MACSIGNSTRING="Apple Certification Authority"


# Sign all files with the executable permission bit set.
FILES=$(find "${TMP_DIR}" -perm +111 -type f -o -name '*.dylib' -type f || find "${TMP_DIR}" -perm /111 -type f -o -name '*.dylib' -type f)

Expand All @@ -132,11 +136,46 @@ signRelease()
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
chmod --reference="${dir}/unsigned_${file}" "$f"
rm -rf "${dir}/unsigned_${file}"
echo File = "$f"
TESTMACSIGN=$(grep -ic "$MACSIGNSTRING" "$f")
echo Sign Result = "$TESTMACSIGN"
if [ "$TESTMACSIGN" -gt 0 ]
then
echo "Code Signed For File $f"
chmod --reference="${dir}/unsigned_${file}" "$f"
rm -rf "${dir}/unsigned_${file}"
else
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
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 [ "$TESTMACSIGN2" -gt 0 ]
then
echo "$f Signed OK On Attempt $iteration"
chmod --reference="${dir}/unsigned_${file}" "$f"
rm -rf "${dir}/unsigned_${file}"
success=true
else
echo "$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
fi
done
fi
done
JDK_DIR=$(ls -d "${TMP_DIR}"/jdk*)
JDK=$(basename "${JDK_DIR}")
JDK=$(basename "${JDK_DIR}")
cd "${TMP_DIR}"
zip -q -r "${TMP_DIR}/unsigned.zip" "${JDK}"
cd -
Expand Down