Skip to content

Commit 6268fa9

Browse files
Merge remote-tracking branch 'origin/beta-releases' into ga-releases
2 parents 5d025c8 + 04e6cb6 commit 6268fa9

File tree

701 files changed

+18009
-23746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

701 files changed

+18009
-23746
lines changed

.evergreen/functions.yml

Lines changed: 154 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ variables:
6464
E2E_TESTS_ATLAS_READANYDATABASE_STRING: ${e2e_tests_atlas_readanydatabase_string}
6565
E2E_TESTS_ATLAS_CUSTOMROLE_STRING: ${e2e_tests_atlas_customrole_string}
6666
E2E_TESTS_ATLAS_SPECIFICPERMISSION_STRING: ${e2e_tests_atlas_specificpermission_string}
67-
NOTARY_URL: http://notary-service.build.10gen.cc:5000
68-
NOTARY_AUTH_TOKEN: ${signing_auth_token}
69-
NOTARY_SIGNING_KEY: ${signing_key_name}
70-
NOTARY_SIGNING_COMMENT: Evergreen project mongodb/compass ${revision} - ${build_variant} - ${branch_name}
7167
MACOS_NOTARY_KEY: ${macos_notary_key}
7268
MACOS_NOTARY_SECRET: ${macos_notary_secret}
7369
MACOS_NOTARY_CLIENT_URL: 'https://macos-notary-1628249594.s3.amazonaws.com/releases/client/latest/darwin_amd64.zip'
@@ -80,6 +76,10 @@ variables:
8076
MONGODB_RUNNER_LOG_DIR: ${workdir}/src/.testserver/
8177
E2E_TESTS_ATLAS_CS_WITHOUT_SEARCH: ${e2e_tests_atlas_cs_without_search}
8278
E2E_TESTS_ATLAS_CS_WITH_SEARCH: ${e2e_tests_atlas_cs_with_search}
79+
GARASIGN_USERNAME: ${garasign_username}
80+
GARASIGN_PASSWORD: ${garasign_password}
81+
ARTIFACTORY_USERNAME: ${artifactory_username}
82+
ARTIFACTORY_PASSWORD: ${artifactory_password}
8383

8484
# This is here with the variables because anchors aren't supported across includes
8585
post:
@@ -122,10 +122,9 @@ post:
122122
remote_file: ${project}/${revision}_${revision_order_id}/vulnerability-report.md
123123
content_type: text/markdown
124124
optional: true
125-
- command: attach.results
125+
- command: attach.xunit_results
126126
params:
127-
file_location: src/packages/compass-e2e-tests/.log/report.json
128-
127+
file: src/.logs/*.xml
129128
functions:
130129
clone:
131130
- command: git.get_project
@@ -307,6 +306,85 @@ functions:
307306
# and be able to find the binary that is used for the tests
308307
file: src/packages/compass/expansions.yml
309308

309+
spawn-signing-server:
310+
# spawn
311+
- command: host.create
312+
type: setup
313+
params:
314+
provider: ec2
315+
distro: ubuntu2004-large
316+
security_group_ids:
317+
- sg-097bff6dd0d1d31d0 # Magic string that's needed for SSH'ing.
318+
# write host info (this file will be read by signingtool when connection to ssh server)
319+
- command: host.list
320+
params:
321+
num_hosts: 1
322+
path: spawned_hosts.json
323+
timeout_seconds: 1200
324+
wait: true
325+
# copy ssh key (this key will be used to connect to ssh server)
326+
- command: shell.exec
327+
params:
328+
shell: bash
329+
script: |
330+
set -e
331+
{
332+
set +x
333+
echo '${__project_aws_ssh_key_value}' > ~/.ssh/mcipacker.pem
334+
chmod 0600 ~/.ssh/mcipacker.pem
335+
set -x
336+
}
337+
# wait for host to be ready
338+
- command: shell.exec
339+
params:
340+
exec_as_string: true
341+
shell: bash
342+
script: |
343+
set -e
344+
user=ubuntu
345+
hostname=$(tr -d '"[]{}' < spawned_hosts.json | cut -d , -f 1 | awk -F : '{print $2}')
346+
identity_file=$(echo ~/.ssh/mcipacker.pem)
347+
348+
attempts=0
349+
connection_attempts=25
350+
351+
## Check for remote connectivity
352+
while ! ssh \
353+
-i "$identity_file" \
354+
-o ConnectTimeout=10 \
355+
-o ForwardAgent=yes \
356+
-o IdentitiesOnly=yes \
357+
-o StrictHostKeyChecking=no \
358+
"$(printf "%s@%s" "$user" "$hostname")" \
359+
exit
360+
do
361+
if [ "$attempts" -ge "$connection_attempts" ]; then
362+
echo "SSH connection failed after $connection_attempts attempts. Exiting..."
363+
exit 1
364+
fi
365+
printf "SSH connection attempt %d/%d failed. Retrying...\n" "$((attempts++))" "$connection_attempts"
366+
## sleep for Permission denied (publickey) errors
367+
sleep 20
368+
done
369+
echo "SSH connection established after $attempts attempts"
370+
371+
# Write the host info so that it can be used by the signing tool
372+
if [[ $OSTYPE == "cygwin" ]]; then
373+
identity_file=$(cygpath -wa "$identity_file")
374+
else
375+
identity_file=$(eval echo "$identity_file")
376+
fi
377+
cat <<EOL > signing_host_info.yml
378+
SIGNING_SERVER_HOSTNAME: $hostname
379+
SIGNING_SERVER_PRIVATE_KEY: $identity_file
380+
SIGNING_SERVER_USERNAME: $user
381+
SIGNING_SERVER_PORT: 22
382+
EOL
383+
# Update the expansions
384+
- command: expansions.update
385+
params:
386+
file: signing_host_info.yml
387+
310388
package:
311389
- command: shell.exec
312390
params:
@@ -317,6 +395,10 @@ functions:
317395
DEBUG: ${debug}
318396
npm_config_loglevel: ${npm_loglevel}
319397
COMPASS_DISTRIBUTION: ${compass_distribution}
398+
SIGNING_SERVER_HOSTNAME: ${SIGNING_SERVER_HOSTNAME}
399+
SIGNING_SERVER_PRIVATE_KEY: ${SIGNING_SERVER_PRIVATE_KEY}
400+
SIGNING_SERVER_USERNAME: ${SIGNING_SERVER_USERNAME}
401+
SIGNING_SERVER_PORT: ${SIGNING_SERVER_PORT}
320402
script: |
321403
set -e
322404
@@ -484,6 +566,29 @@ functions:
484566
tar -xvz)
485567
export COMPASS_CRYPT_LIBRARY_PATH=$(echo $PWD/mongodb-crypt/lib/mongo_*_v1.*)
486568
npm run test-csfle --workspace mongodb-data-service
569+
570+
verify-artifacts:
571+
- command: shell.exec
572+
params:
573+
working_dir: src
574+
shell: bash
575+
env:
576+
# These are set in the apply-compass-target-expansion func
577+
WINDOWS_EXE_NAME: ${windows_setup_filename}
578+
WINDOWS_MSI_NAME: ${windows_msi_filename}
579+
WINDOWS_ZIP_NAME: ${windows_zip_filename}
580+
WINDOWS_NUPKG_NAME: ${windows_nupkg_full_filename}
581+
OSX_DMG_NAME: ${osx_dmg_filename}
582+
OSX_ZIP_NAME: ${osx_zip_filename}
583+
RHEL_RPM_NAME: ${linux_rpm_filename}
584+
RHEL_TAR_NAME: ${rhel_tar_filename}
585+
LINUX_DEB_NAME: ${linux_deb_filename}
586+
LINUX_TAR_NAME: ${linux_tar_filename}
587+
script: |
588+
set -e
589+
# Load environment variables
590+
eval $(.evergreen/print-compass-env.sh)
591+
.evergreen/verify-artifacts.sh
487592
488593
save-all-artifacts:
489594
- command: s3.put
@@ -505,12 +610,26 @@ functions:
505610
remote_file: ${project}/${revision}_${revision_order_id}/${windows_zip_filename}
506611
content_type: application/zip
507612
optional: true
613+
- command: s3.put
614+
params:
615+
<<: *save-artifact-params-public
616+
local_file: src/packages/compass/dist/${windows_zip_sign_filename}
617+
remote_file: ${project}/${revision}_${revision_order_id}/${windows_zip_sign_filename}
618+
content_type: application/pgp-signature
619+
optional: true
508620
- command: s3.put
509621
params:
510622
<<: *save-artifact-params-public
511623
local_file: src/packages/compass/dist/${windows_nupkg_full_filename}
512624
remote_file: ${project}/${revision}_${revision_order_id}/${windows_nupkg_full_filename}
513625
optional: true
626+
- command: s3.put
627+
params:
628+
<<: *save-artifact-params-public
629+
local_file: src/packages/compass/dist/${windows_nupkg_full_sign_filename}
630+
remote_file: ${project}/${revision}_${revision_order_id}/${windows_nupkg_full_sign_filename}
631+
content_type: application/pgp-signature
632+
optional: true
514633
- command: s3.put
515634
params:
516635
<<: *save-artifact-params-public
@@ -531,6 +650,13 @@ functions:
531650
remote_file: ${project}/${revision}_${revision_order_id}/${osx_zip_filename}
532651
content_type: application/zip
533652
optional: true
653+
- command: s3.put
654+
params:
655+
<<: *save-artifact-params-public
656+
local_file: src/packages/compass/dist/${osx_zip_sign_filename}
657+
remote_file: ${project}/${revision}_${revision_order_id}/${osx_zip_sign_filename}
658+
content_type: application/pgp-signature
659+
optional: true
534660
- command: s3.put
535661
params:
536662
<<: *save-artifact-params-public
@@ -545,20 +671,41 @@ functions:
545671
remote_file: ${project}/${revision}_${revision_order_id}/${rhel_tar_filename}
546672
content_type: application/x-gzip
547673
optional: true
674+
- command: s3.put
675+
params:
676+
<<: *save-artifact-params-public
677+
local_file: src/packages/compass/dist/${rhel_tar_sign_filename}
678+
remote_file: ${project}/${revision}_${revision_order_id}/${rhel_tar_sign_filename}
679+
content_type: application/pgp-signature
680+
optional: true
548681
- command: s3.put
549682
params:
550683
<<: *save-artifact-params-public
551684
local_file: src/packages/compass/dist/${linux_deb_filename}
552685
remote_file: ${project}/${revision}_${revision_order_id}/${linux_deb_filename}
553686
content_type: application/vnd.debian.binary-package
554687
optional: true
688+
- command: s3.put
689+
params:
690+
<<: *save-artifact-params-public
691+
local_file: src/packages/compass/dist/${linux_deb_sign_filename}
692+
remote_file: ${project}/${revision}_${revision_order_id}/${linux_deb_sign_filename}
693+
content_type: application/pgp-signature
694+
optional: true
555695
- command: s3.put
556696
params:
557697
<<: *save-artifact-params-public
558698
local_file: src/packages/compass/dist/${linux_tar_filename}
559699
remote_file: ${project}/${revision}_${revision_order_id}/${linux_tar_filename}
560700
content_type: application/x-gzip
561701
optional: true
702+
- command: s3.put
703+
params:
704+
<<: *save-artifact-params-public
705+
local_file: src/packages/compass/dist/${linux_tar_sign_filename}
706+
remote_file: ${project}/${revision}_${revision_order_id}/${linux_tar_sign_filename}
707+
content_type: application/pgp-signature
708+
optional: true
562709

563710
get-all-artifacts:
564711
- command: shell.exec

.evergreen/tasks.in.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@ tasks:
105105
- func: apply-compass-target-expansion
106106
vars:
107107
compass_distribution: <% out(packageTask.vars.compass_distribution) %>
108+
- func: spawn-signing-server
108109
- func: package
109110
vars:
110111
debug: 'hadron*,mongo*,compass*,electron*'
111112
compass_distribution: <% out(packageTask.vars.compass_distribution) %>
113+
- func: verify-artifacts
112114
- func: save-all-artifacts
113115
vars:
114116
compass_distribution: <% out(packageTask.vars.compass_distribution) %>

.evergreen/tasks.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@ tasks:
105105
- func: apply-compass-target-expansion
106106
vars:
107107
compass_distribution: compass
108+
- func: spawn-signing-server
108109
- func: package
109110
vars:
110111
debug: 'hadron*,mongo*,compass*,electron*'
111112
compass_distribution: compass
113+
- func: verify-artifacts
112114
- func: save-all-artifacts
113115
vars:
114116
compass_distribution: compass
@@ -124,10 +126,12 @@ tasks:
124126
- func: apply-compass-target-expansion
125127
vars:
126128
compass_distribution: compass-readonly
129+
- func: spawn-signing-server
127130
- func: package
128131
vars:
129132
debug: 'hadron*,mongo*,compass*,electron*'
130133
compass_distribution: compass-readonly
134+
- func: verify-artifacts
131135
- func: save-all-artifacts
132136
vars:
133137
compass_distribution: compass-readonly
@@ -143,10 +147,12 @@ tasks:
143147
- func: apply-compass-target-expansion
144148
vars:
145149
compass_distribution: compass-isolated
150+
- func: spawn-signing-server
146151
- func: package
147152
vars:
148153
debug: 'hadron*,mongo*,compass*,electron*'
149154
compass_distribution: compass-isolated
155+
- func: verify-artifacts
150156
- func: save-all-artifacts
151157
vars:
152158
compass_distribution: compass-isolated

.evergreen/verify-artifacts.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#! /usr/bin/env bash
2+
3+
set -e
4+
5+
ARTIFACTS_DIR="packages/compass/dist"
6+
echo "Verifying artifacts at $ARTIFACTS_DIR"
7+
ls -l $ARTIFACTS_DIR
8+
9+
# Use tmp directory for all gpg operations
10+
GPG_HOME=$(mktemp -d)
11+
TMP_FILE=$(mktemp)
12+
COMPASS_KEY="https://pgp.mongodb.com/compass.asc"
13+
14+
trap_handler() {
15+
local code=$?
16+
if [ $code -eq 0 ]; then
17+
echo "Verification successful"
18+
else
19+
echo "Verification failed with exit code $code"
20+
cat "$TMP_FILE"
21+
fi
22+
rm -f "$TMP_FILE"
23+
rm -rf "$GPG_HOME"
24+
exit $code
25+
}
26+
27+
trap trap_handler ERR EXIT
28+
29+
verify_using_gpg() {
30+
echo "Verifying $1 using gpg"
31+
gpg --homedir $GPG_HOME --verify $ARTIFACTS_DIR/$1.sig $ARTIFACTS_DIR/$1 > "$TMP_FILE" 2>&1
32+
}
33+
34+
verify_using_powershell() {
35+
echo "Verifying $1 using powershell"
36+
powershell Get-AuthenticodeSignature -FilePath $ARTIFACTS_DIR/$1 > "$TMP_FILE" 2>&1
37+
}
38+
39+
verify_using_codesign() {
40+
echo "Verifying $1 using codesign"
41+
codesign -dv --verbose=4 $ARTIFACTS_DIR/$1 > "$TMP_FILE" 2>&1
42+
}
43+
44+
verify_using_rpm() {
45+
# RPM packages are signed using gpg and the signature is embedded in the package.
46+
# Here, we need to import the key in `rpm` and then verify the signature.
47+
echo "Importing key into rpm"
48+
rpm --import $COMPASS_KEY > "$TMP_FILE" 2>&1
49+
# Even if the file is not signed, the command below will exit with 0 and output something like: sha1 md5 OK
50+
# So we need to check the output of the command to see if the file is signed successfully.
51+
echo "Verifying $1 using rpm"
52+
output=$(rpm -K $ARTIFACTS_DIR/$1)
53+
# Remove the imported key from rpm
54+
rpm -e $(rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release}:%{summary}\n' | grep compass | awk -F: '{print $1}')
55+
56+
# Check if the output contains the string "pgp md5 OK"
57+
if [[ $output != *"pgp md5 OK"* ]]; then
58+
echo "File $1 is not signed"
59+
exit 1
60+
fi
61+
}
62+
63+
setup_gpg() {
64+
echo "Importing Compass public key"
65+
curl $COMPASS_KEY | gpg --homedir $GPG_HOME --import > "$TMP_FILE" 2>&1
66+
}
67+
68+
if [ "$IS_WINDOWS" = true ]; then
69+
verify_using_powershell $WINDOWS_EXE_NAME
70+
verify_using_powershell $WINDOWS_MSI_NAME
71+
echo "Skipping verification for Windows artifacts using gpg: $WINDOWS_ZIP_NAME, $WINDOWS_NUPKG_NAME"
72+
elif [ "$IS_UBUNTU" = true ]; then
73+
setup_gpg
74+
verify_using_gpg $LINUX_DEB_NAME
75+
verify_using_gpg $LINUX_TAR_NAME
76+
elif [ "$IS_RHEL" = true ]; then
77+
setup_gpg
78+
verify_using_rpm $RHEL_RPM_NAME
79+
verify_using_gpg $RHEL_TAR_NAME
80+
elif [ "$IS_OSX" = true ]; then
81+
setup_gpg
82+
verify_using_gpg $OSX_ZIP_NAME
83+
verify_using_codesign $OSX_DMG_NAME
84+
else
85+
echo "Unknown OS, failed to verify file signing"
86+
exit 1
87+
fi

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
* text=auto eol=lf
2+
*.gz binary
3+
*.png binary
4+
*.jpg binary
5+
*.gif binary
6+
*.exe binary
7+
*.ico binary
8+
*.icns binary
29
/packages/bson-transpilers/lib/**/* linguist-generated=true
310
packages/compass-crud/test/fixture-results/* linguist-generated=true

0 commit comments

Comments
 (0)