@@ -310,6 +310,85 @@ functions:
310310 # and be able to find the binary that is used for the tests
311311 file : src/packages/compass/expansions.yml
312312
313+ spawn-signing-server :
314+ # spawn
315+ - command : host.create
316+ type : setup
317+ params :
318+ provider : ec2
319+ distro : ubuntu2004-large
320+ security_group_ids :
321+ - sg-097bff6dd0d1d31d0 # Magic string that's needed for SSH'ing.
322+ # write host info (this file will be read by signingtool when connection to ssh server)
323+ - command : host.list
324+ params :
325+ num_hosts : 1
326+ path : spawned_hosts.json
327+ timeout_seconds : 1200
328+ wait : true
329+ # copy ssh key (this key will be used to connect to ssh server)
330+ - command : shell.exec
331+ params :
332+ shell : bash
333+ script : |
334+ set -e
335+ {
336+ set +x
337+ echo '${__project_aws_ssh_key_value}' > ~/.ssh/mcipacker.pem
338+ chmod 0600 ~/.ssh/mcipacker.pem
339+ set -x
340+ }
341+ # wait for host to be ready
342+ - command : shell.exec
343+ params :
344+ exec_as_string : true
345+ shell : bash
346+ script : |
347+ set -e
348+ user=ubuntu
349+ hostname=$(tr -d '"[]{}' < spawned_hosts.json | cut -d , -f 1 | awk -F : '{print $2}')
350+ identity_file=$(echo ~/.ssh/mcipacker.pem)
351+
352+ attempts=0
353+ connection_attempts=25
354+
355+ ## Check for remote connectivity
356+ while ! ssh \
357+ -i "$identity_file" \
358+ -o ConnectTimeout=10 \
359+ -o ForwardAgent=yes \
360+ -o IdentitiesOnly=yes \
361+ -o StrictHostKeyChecking=no \
362+ "$(printf "%s@%s" "$user" "$hostname")" \
363+ exit
364+ do
365+ if [ "$attempts" -ge "$connection_attempts" ]; then
366+ echo "SSH connection failed after $connection_attempts attempts. Exiting..."
367+ exit 1
368+ fi
369+ printf "SSH connection attempt %d/%d failed. Retrying...\n" "$((attempts++))" "$connection_attempts"
370+ ## sleep for Permission denied (publickey) errors
371+ sleep 20
372+ done
373+ echo "SSH connection established after $attempts attempts"
374+
375+ # Write the host info so that it can be used by the signing tool
376+ if [[ $OSTYPE == "cygwin" ]]; then
377+ identity_file=$(cygpath -wa "$identity_file")
378+ else
379+ identity_file=$(eval echo "$identity_file")
380+ fi
381+ cat <<EOL > signing_host_info.yml
382+ SIGNING_SERVER_HOSTNAME : $hostname
383+ SIGNING_SERVER_PRIVATE_KEY : $identity_file
384+ SIGNING_SERVER_USERNAME : $user
385+ SIGNING_SERVER_PORT : 22
386+ EOL
387+ # Update the expansions
388+ - command : expansions.update
389+ params :
390+ file : signing_host_info.yml
391+
313392 package :
314393 - command : shell.exec
315394 params :
@@ -320,6 +399,10 @@ functions:
320399 DEBUG : ${debug}
321400 npm_config_loglevel : ${npm_loglevel}
322401 COMPASS_DISTRIBUTION : ${compass_distribution}
402+ SIGNING_SERVER_HOSTNAME : ${SIGNING_SERVER_HOSTNAME}
403+ SIGNING_SERVER_PRIVATE_KEY : ${SIGNING_SERVER_PRIVATE_KEY}
404+ SIGNING_SERVER_USERNAME : ${SIGNING_SERVER_USERNAME}
405+ SIGNING_SERVER_PORT : ${SIGNING_SERVER_PORT}
323406 script : |
324407 set -e
325408
@@ -508,12 +591,26 @@ functions:
508591 remote_file : ${project}/${revision}_${revision_order_id}/${windows_zip_filename}
509592 content_type : application/zip
510593 optional : true
594+ - command : s3.put
595+ params :
596+ << : *save-artifact-params-public
597+ local_file : src/packages/compass/dist/${windows_zip_sign_filename}
598+ remote_file : ${project}/${revision}_${revision_order_id}/${windows_zip_sign_filename}
599+ content_type : application/pgp-signature
600+ optional : true
511601 - command : s3.put
512602 params :
513603 << : *save-artifact-params-public
514604 local_file : src/packages/compass/dist/${windows_nupkg_full_filename}
515605 remote_file : ${project}/${revision}_${revision_order_id}/${windows_nupkg_full_filename}
516606 optional : true
607+ - command : s3.put
608+ params :
609+ << : *save-artifact-params-public
610+ local_file : src/packages/compass/dist/${windows_nupkg_full_sign_filename}
611+ remote_file : ${project}/${revision}_${revision_order_id}/${windows_nupkg_full_sign_filename}
612+ content_type : application/pgp-signature
613+ optional : true
517614 - command : s3.put
518615 params :
519616 << : *save-artifact-params-public
@@ -534,20 +631,41 @@ functions:
534631 remote_file : ${project}/${revision}_${revision_order_id}/${osx_zip_filename}
535632 content_type : application/zip
536633 optional : true
634+ - command : s3.put
635+ params :
636+ << : *save-artifact-params-public
637+ local_file : src/packages/compass/dist/${osx_zip_sign_filename}
638+ remote_file : ${project}/${revision}_${revision_order_id}/${osx_zip_sign_filename}
639+ content_type : application/pgp-signature
640+ optional : true
537641 - command : s3.put
538642 params :
539643 << : *save-artifact-params-public
540644 local_file : src/packages/compass/dist/${linux_rpm_filename}
541645 remote_file : ${project}/${revision}_${revision_order_id}/${linux_rpm_filename}
542646 content_type : application/x-redhat-package-manager
543647 optional : true
648+ - command : s3.put
649+ params :
650+ << : *save-artifact-params-public
651+ local_file : src/packages/compass/dist/${linux_rpm_sign_filename}
652+ remote_file : ${project}/${revision}_${revision_order_id}/${linux_rpm_sign_filename}
653+ content_type : application/pgp-signature
654+ optional : true
544655 - command : s3.put
545656 params :
546657 << : *save-artifact-params-public
547658 local_file : src/packages/compass/dist/${rhel_tar_filename}
548659 remote_file : ${project}/${revision}_${revision_order_id}/${rhel_tar_filename}
549660 content_type : application/x-gzip
550661 optional : true
662+ - command : s3.put
663+ params :
664+ << : *save-artifact-params-public
665+ local_file : src/packages/compass/dist/${rhel_tar_sign_filename}
666+ remote_file : ${project}/${revision}_${revision_order_id}/${rhel_tar_sign_filename}
667+ content_type : application/pgp-signature
668+ optional : true
551669 - command : s3.put
552670 params :
553671 << : *save-artifact-params-public
0 commit comments