@@ -18,10 +18,20 @@ const mongodbNotaryServiceClient = require('@mongodb-js/mongodb-notary-service-c
1818const which = require ( 'which' ) ;
1919const plist = require ( 'plist' ) ;
2020const { signtool } = require ( './signtool' ) ;
21+ const { sign : garasign } = require ( '@mongodb-js/signing-utils' ) ;
2122const tarGz = require ( './tar-gz' ) ;
2223
23- async function signLinuxPackage ( src ) {
24- debug ( 'Signing ... %s' , src ) ;
24+ async function signLocallyWithGpg ( src ) {
25+ debug ( 'Signing locally with gpg ... %s' , src ) ;
26+ await garasign ( src , {
27+ client : 'local' ,
28+ signingMethod : 'gpg' ,
29+ } ) ;
30+ debug ( 'Successfully signed %s' , src ) ;
31+ }
32+
33+ async function signRpmPackage ( src ) {
34+ debug ( 'Signing rpm .. %s' , src ) ;
2535 await mongodbNotaryServiceClient ( src ) ;
2636 debug ( 'Successfully signed %s' , src ) ;
2737}
@@ -646,6 +656,9 @@ class Target {
646656 const debianArch = this . arch === 'x64' ? 'amd64' : 'i386' ;
647657 const debianSection = _ . get ( platformSettings , 'deb_section' ) ;
648658 this . linux_deb_filename = `${ this . slug } _${ debianVersion } _${ debianArch } .deb` ;
659+ this . linux_deb_sign_filename = `${ this . linux_deb_filename } .sig` ;
660+ this . linux_tar_filename = `${ this . slug } -${ this . version } -${ this . platform } -${ this . arch } .tar.gz` ;
661+ this . linux_tar_sign_filename = `${ this . linux_tar_filename } .sig` ;
649662
650663 const rhelVersion = [
651664 this . semver . major ,
@@ -656,7 +669,6 @@ class Target {
656669 const rhelArch = this . arch === 'x64' ? 'x86_64' : 'i386' ;
657670 const rhelCategories = _ . get ( platformSettings , 'rpm_categories' ) ;
658671 this . linux_rpm_filename = `${ this . slug } -${ this . version } .${ rhelArch } .rpm` ;
659- this . linux_tar_filename = `${ this . slug } -${ this . version } -${ this . platform } -${ this . arch } .tar.gz` ;
660672 this . rhel_tar_filename = `${ this . slug } -${ this . version } -rhel-${ this . arch } .tar.gz` ;
661673
662674 this . assets = [
@@ -665,6 +677,10 @@ class Target {
665677 path : this . dest ( this . linux_deb_filename ) ,
666678 downloadCenter : true
667679 } ,
680+ {
681+ name : this . linux_deb_sign_filename ,
682+ path : this . dest ( this . linux_deb_sign_filename ) ,
683+ } ,
668684 {
669685 name : this . linux_rpm_filename ,
670686 path : this . dest ( this . linux_rpm_filename ) ,
@@ -674,6 +690,10 @@ class Target {
674690 name : this . linux_tar_filename ,
675691 path : this . dest ( this . linux_tar_filename )
676692 } ,
693+ {
694+ name : this . linux_tar_sign_filename ,
695+ path : this . dest ( this . linux_tar_sign_filename )
696+ } ,
677697 {
678698 name : this . rhel_tar_filename ,
679699 path : this . dest ( this . rhel_tar_filename )
@@ -731,7 +751,7 @@ class Target {
731751 const createRpm = require ( 'electron-installer-redhat' ) ;
732752 debug ( 'creating rpm...' , this . installerOptions . rpm ) ;
733753 return createRpm ( this . installerOptions . rpm ) . then ( ( ) => {
734- return signLinuxPackage ( this . dest ( this . linux_rpm_filename ) ) ;
754+ return signRpmPackage ( this . dest ( this . linux_rpm_filename ) ) ;
735755 } ) ;
736756 } ) ;
737757 } ;
@@ -741,12 +761,7 @@ class Target {
741761 const createDeb = require ( 'electron-installer-debian' ) ;
742762 debug ( 'creating deb...' , this . installerOptions . deb ) ;
743763 return createDeb ( this . installerOptions . deb ) . then ( ( ) => {
744- // We do not sign debs because it doesn't work, see
745- // this thread for context:
746- // https://mongodb.slack.com/archives/G2L10JAV7/p1623169331107600
747- //
748- // return sign(this.dest(this.linux_deb_filename));
749- return this . dest ( this . linux_deb_filename ) ;
764+ return signLocallyWithGpg ( this . dest ( this . linux_deb_filename ) ) ;
750765 } ) ;
751766 } ) ;
752767 } ;
@@ -758,7 +773,12 @@ class Target {
758773 this . dest ( this . app_archive_name )
759774 ) ;
760775
761- return tarGz ( this . appPath , this . dest ( this . app_archive_name ) ) ;
776+ return tarGz ( this . appPath , this . dest ( this . app_archive_name ) ) . then ( ( ) => {
777+ if ( process . env . EVERGREEN_BUILD_VARIANT === 'rhel' ) {
778+ return ;
779+ }
780+ return signLocallyWithGpg ( this . dest ( this . app_archive_name ) ) ;
781+ } ) ;
762782 } ;
763783
764784 this . createInstaller = ( ) => {
0 commit comments