- Timestamp:
- 12/22/21 10:39:44 (3 years ago)
- Location:
- issm/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 25837-25866,25868-25993,25995-26330,26332-26733,26736-26739,26741
- Property svn:mergeinfo changed
-
issm/trunk/packagers/mac/sign-issm-mac-binaries-python.sh
r25836 r26744 5 5 # Cybersecurity server for signing macOS applications. Polls SCM of the 6 6 # Subversion repository hosted at 7 # https://issm.ess.uci.edu/svn/issm-binaries/mac/ python/unsigned to trigger new7 # https://issm.ess.uci.edu/svn/issm-binaries/mac/matlab/unsigned to trigger new 8 8 # builds. 9 9 # … … 17 17 # 'Add Credentials' and enter the crendentials from above. 18 18 # - From the 'Dashboard', select 'New Item' -> 'Freestyle project'. 19 # - Under 'Source Code Management', select 'Subversion'. 19 # - Under 'Source Code Management', select 'Subversion'. 20 20 # - The 'Repository URL' text field should be set to 21 # "https://issm.ess.uci.edu/svn/issm-binaries/mac/ python/unsigned"21 # "https://issm.ess.uci.edu/svn/issm-binaries/mac/matlab/unsigned". 22 22 # - The 'Credentials' select menu should be set to the new credentials 23 23 # created previously. 24 # - The 'Local module directory' text field should be set to the same 25 # value as the constant UNSIGNED_REPO_COPY (set below to './unsigned'). 24 26 # - Under 'Build Trigggers', check the box for 'Poll SCM' and set the 25 27 # 'Schedule' text area to "H/5 * * * *". … … 27 29 # file(s)', then under 'Bindings' click the 'Add...' button and select 28 30 # 'Username and password (separated)'. 29 # - Set 'Username Variable' to " issm-binaries-user”.30 # - Set 'Password Variable' to " issm-binaries-pass”.31 # - Set 'Username Variable' to "ISSM_BINARIES_USER". 32 # - Set 'Password Variable' to "ISSM_BINARIES_PASS". 31 33 # - Under 'Credentials', select the same, new credentials that created 32 34 # previously. … … 40 42 # 41 43 # NOTE: 42 # - Assumes that 'issm-binaries-user' and 'issm-binaries-pass'are set up in44 # - Assumes that "ISSM_BINARIES_USER" and "ISSM_BINARIES_PASS" are set up in 43 45 # the 'Bindings' section under a 'Username and password (separated)' binding 44 46 # (requires 'Credentials Binding Plugin'). … … 47 49 ################################################################################ 48 50 51 # Expand aliases within the context of this script 52 shopt -s expand_aliases 53 49 54 # From https://developer.apple.com/documentation/macos-release-notes/macos-catalina-10_15-release-notes, 50 55 # … … 60 65 # is available in PATH. 61 66 # 62 shopt -s expand_aliases 67 # NOTE: May be able to remove this after updating macOS. 68 # 63 69 alias svn='/usr/local/bin/svn' 64 70 … … 74 80 ALTOOL_PASSWORD="@keychain:**********" # altool password (assumed to be stored in keychain) 75 81 ASC_PROVIDER="**********" 76 NOTARIZATION_CHECK_ATTEMPTS=60 82 MAX_SVN_ATTEMPTS=10 83 NOTARIZATION_CHECK_ATTEMPTS=20 77 84 NOTARIZATION_CHECK_PERIOD=60 78 85 NOTARIZATION_LOGFILE="notarization.log" 79 86 NOTARIZATION_LOGFILE_PATH="." 87 PASSWORD=${ISSM_BINARIES_PASS} 80 88 PKG="ISSM-macOS-Python" 81 PRIMARY_BUNDLE_ID="**********.issm.python" # Maybe "nasa.jpl.issm.matlab"? 82 RETRIGGER_SIGNING_FILE="retrigger.txt" 89 PRIMARY_BUNDLE_ID="gov.nasa.jpl.issm.python" 83 90 SIGNED_REPO_COPY="./signed" 84 91 SIGNED_REPO_URL="https://issm.ess.uci.edu/svn/issm-binaries/mac/python/signed" … … 87 94 UNSIGNED_REPO_COPY="./unsigned" 88 95 UNSIGNED_REPO_URL="https://issm.ess.uci.edu/svn/issm-binaries/mac/python/unsigned" 96 USERNAME=${ISSM_BINARIES_USER} 89 97 90 98 COMPRESSED_PKG="${PKG}.zip" 91 99 EXE_ENTITLEMENTS_PLIST="${PKG}/bin/entitlements.plist" 92 100 93 # Clean up from previous packaging (not necessary for single builds on Jenkins, 94 # but useful when testing packaging locally) 95 echo "Cleaning up existing assets" 96 rm -rf ${PKG} ${COMPRESSED_PKG} ${NOTARIZATION_LOGFILE_PATH}/${NOTARIZATION_LOGFILE} ${SIGNED_REPO_COPY} ${UNSIGNED_REPO_COPY} 97 mkdir ${PKG} 98 99 # Check out copy of repository for unsigned packages 100 echo "Checking out copy of respository for unsigned packages" 101 svn co \ 102 --username ${USERNAME} \ 103 --password ${PASSWORD} \ 104 ${UNSIGNED_REPO_URL} \ 105 ${UNSIGNED_REPO_COPY} > /dev/null 2>&1 101 # NOTE: Uncomment the following for local testing (Jenkins checks out copy of 102 # repository for unsigned packages to working directory) 103 # 104 105 # # Clean up from previous packaging (not necessary for single builds on Jenkins, 106 # # but useful when testing packaging locally) 107 # echo "Cleaning up existing assets" 108 # rm -rf ${COMPRESSED_PKG} ${NOTARIZATION_LOGFILE_PATH}/${NOTARIZATION_LOGFILE} ${UNSIGNED_REPO_COPY} 109 110 # # Check out copy of repository for unsigned packages 111 # echo "Checking out copy of respository for unsigned packages" 112 # svn checkout \ 113 # --trust-server-cert \ 114 # --non-interactive \ 115 # --username ${USERNAME} \ 116 # --password ${PASSWORD} \ 117 # ${UNSIGNED_REPO_URL} \ 118 # ${UNSIGNED_REPO_COPY} 119 120 rm -rf ${PKG} ${SIGNED_REPO_COPY} 121 106 122 107 123 # Extract package contents … … 163 179 # Check if UUID exists in response 164 180 HAS_UUID=$(grep 'RequestUUID = ' ${NOTARIZATION_LOGFILE_PATH}/${NOTARIZATION_LOGFILE}) # NOTE: Checking for "RequestUUID = " because "RequestUUID" shows up in some error messages 165 if [ [ -z "${HAS_UUID}" ]]; then181 if [ -z "${HAS_UUID}" ]; then 166 182 echo "Notarization failed!" 167 183 echo "----------------------- Contents of notarization logfile -----------------------" … … 195 211 # First, check if there is an error 196 212 ERROR_CHECK=$(grep 'Error' ${NOTARIZATION_LOGFILE_PATH}/${NOTARIZATION_LOGFILE}) 197 if [ [ ! -z "${ERROR_CHECK}" ]]; then213 if [ ! -z "${ERROR_CHECK}" ]; then 198 214 break 199 215 fi … … 242 258 fi 243 259 244 # Remove dummy file for retriggering signing/notarization (if it exists)245 svn delete ${UNSIGNED_REPO_COPY}/${RETRIGGER_SIGNING_FILE} > /dev/null 2>&1246 svn commit --message "DEL: Removing dummy file for retriggering signing of same package" ${UNSIGNED_REPO_COPY} > /dev/null 2>&1247 248 260 # Check out copy of repository for signed packages 249 261 echo "Checking out copy of respository for signed packages" 250 svn co \ 251 --username ${USERNAME} \ 252 --password ${PASSWORD} \ 253 ${SIGNED_REPO_URL} \ 254 ${SIGNED_REPO_COPY} > /dev/null 2>&1 262 SVN_ATTEMPT=0 263 SVN_SUCCESS=0 264 while [[ ${SVN_ATTEMPT} -lt ${MAX_SVN_ATTEMPTS} && ${SVN_SUCCESS} -eq 0 ]]; do 265 rm -rf ${SIGNED_REPO_COPY} 266 svn checkout \ 267 --trust-server-cert \ 268 --non-interactive \ 269 --username ${USERNAME} \ 270 --password ${PASSWORD} \ 271 ${SIGNED_REPO_URL} \ 272 ${SIGNED_REPO_COPY} > /dev/null 2>&1 273 if [ $? -eq 0 ]; then 274 SVN_SUCCESS=1 275 break 276 else 277 ((++SVN_ATTEMPT)) 278 sleep 5 279 fi 280 done 281 282 if [ ${SVN_SUCCESS} -eq 0 ]; then 283 echo "Checkout of respository for signed packages failed" 284 exit 1 285 fi 255 286 256 287 # Copy notarization file to repository for signed packages … … 259 290 260 291 # Remove lock file from repository for signed packages 261 svn delete ${SIGNED_REPO_COPY}/${SIGNING_LOCK_FILE} > /dev/null 2>&1 262 292 svn delete ${SIGNED_REPO_COPY}/${SIGNING_LOCK_FILE} 293 294 SVN_ATTEMPT=0 295 SVN_SUCCESS=0 263 296 if [ ${SUCCESS} -eq 1 ]; then 264 297 # Copy signed package to repository for signed packages … … 268 301 # Commit changes 269 302 echo "Committing changes to repository for signed packages" 270 svn commit --message "CHG: New signed package (success)" ${SIGNED_REPO_COPY} > /dev/null 2>&1 303 while [[ ${SVN_ATTEMPT} -lt ${MAX_SVN_ATTEMPTS} && ${SVN_SUCCESS} -eq 0 ]]; do 304 svn commit \ 305 --trust-server-cert \ 306 --non-interactive \ 307 --username ${USERNAME} \ 308 --password ${PASSWORD} \ 309 --message "CHG: New signed package (success)" ${SIGNED_REPO_COPY} > /dev/null 2>&1 310 if [ $? -eq 0 ]; then 311 SVN_SUCCESS=1 312 break 313 else 314 ((++SVN_ATTEMPT)) 315 sleep 5 316 fi 317 done 318 319 if [ ${SVN_SUCCESS} -eq 0 ]; then 320 echo "Commit to respository for signed packages failed" 321 exit 1 322 fi 271 323 else 272 324 # Commit changes 273 325 echo "Committing changes to repository for signed packages" 274 svn commit --message "CHG: New signed package (failure)" ${SIGNED_REPO_COPY} > /dev/null 2>&1 326 while [[ ${SVN_ATTEMPT} -lt ${MAX_SVN_ATTEMPTS} && ${SVN_SUCCESS} -eq 0 ]]; do 327 svn commit \ 328 --trust-server-cert \ 329 --non-interactive \ 330 --username ${USERNAME} \ 331 --password ${PASSWORD} \ 332 --message "CHG: New signed package (failure)" ${SIGNED_REPO_COPY} > /dev/null 2>&1 333 if [ $? -eq 0 ]; then 334 SVN_SUCCESS=1 335 break 336 else 337 ((++SVN_ATTEMPT)) 338 sleep 5 339 fi 340 done 341 342 if [ ${SVN_SUCCESS} -eq 0 ]; then 343 echo "Commit to respository for signed packages failed" 344 exit 1 345 fi 275 346 276 347 exit 1
Note:
See TracChangeset
for help on using the changeset viewer.