bson 4.14.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +4 -4
- data/Rakefile +5 -0
- data/ext/bson/bson-native.h +12 -4
- data/ext/bson/extconf.rb +8 -3
- data/ext/bson/init.c +11 -11
- data/ext/bson/read.c +21 -6
- data/ext/bson/util.c +168 -16
- data/ext/bson/write.c +30 -39
- data/lib/bson/active_support.rb +1 -0
- data/lib/bson/array.rb +57 -31
- data/lib/bson/big_decimal.rb +16 -6
- data/lib/bson/binary.rb +255 -128
- data/lib/bson/boolean.rb +1 -0
- data/lib/bson/code.rb +9 -11
- data/lib/bson/code_with_scope.rb +8 -10
- data/lib/bson/config.rb +1 -27
- data/lib/bson/date.rb +2 -1
- data/lib/bson/date_time.rb +2 -1
- data/lib/bson/db_pointer.rb +11 -12
- data/lib/bson/dbref.rb +11 -9
- data/lib/bson/decimal128/builder.rb +9 -8
- data/lib/bson/decimal128.rb +33 -109
- data/lib/bson/document.rb +1 -0
- data/lib/bson/environment.rb +1 -0
- data/lib/bson/error/bson_decode_error.rb +11 -0
- data/lib/bson/error/ext_json_parse_error.rb +11 -0
- data/lib/bson/error/illegal_key.rb +23 -0
- data/lib/bson/error/invalid_binary_type.rb +37 -0
- data/lib/bson/error/invalid_dbref_argument.rb +12 -0
- data/lib/bson/error/invalid_decimal128_argument.rb +25 -0
- data/lib/bson/error/invalid_decimal128_range.rb +27 -0
- data/lib/bson/error/invalid_decimal128_string.rb +26 -0
- data/lib/bson/error/invalid_key.rb +24 -0
- data/lib/bson/error/invalid_object_id.rb +11 -0
- data/lib/bson/error/invalid_regexp_pattern.rb +13 -0
- data/lib/bson/error/unrepresentable_precision.rb +19 -0
- data/lib/bson/error/unserializable_class.rb +13 -0
- data/lib/bson/error/unsupported_binary_subtype.rb +12 -0
- data/lib/bson/error/unsupported_type.rb +11 -0
- data/lib/bson/error.rb +16 -28
- data/lib/bson/ext_json.rb +1 -0
- data/lib/bson/false_class.rb +2 -1
- data/lib/bson/float.rb +2 -1
- data/lib/bson/hash.rb +127 -72
- data/lib/bson/int32.rb +16 -4
- data/lib/bson/int64.rb +16 -4
- data/lib/bson/integer.rb +3 -4
- data/lib/bson/json.rb +1 -0
- data/lib/bson/max_key.rb +7 -9
- data/lib/bson/min_key.rb +7 -9
- data/lib/bson/nil_class.rb +1 -0
- data/lib/bson/object.rb +5 -25
- data/lib/bson/object_id.rb +75 -121
- data/lib/bson/open_struct.rb +3 -2
- data/lib/bson/regexp.rb +35 -64
- data/lib/bson/registry.rb +2 -6
- data/lib/bson/specialized.rb +2 -1
- data/lib/bson/string.rb +4 -27
- data/lib/bson/symbol.rb +22 -19
- data/lib/bson/time.rb +2 -1
- data/lib/bson/time_with_zone.rb +13 -1
- data/lib/bson/timestamp.rb +2 -1
- data/lib/bson/true_class.rb +2 -1
- data/lib/bson/undefined.rb +14 -0
- data/lib/bson/version.rb +2 -1
- data/lib/bson.rb +3 -2
- data/spec/bson/array_spec.rb +19 -60
- data/spec/bson/big_decimal_spec.rb +16 -4
- data/spec/bson/binary_spec.rb +83 -74
- data/spec/bson/binary_uuid_spec.rb +1 -0
- data/spec/bson/boolean_spec.rb +1 -0
- data/spec/bson/byte_buffer_read_spec.rb +1 -0
- data/spec/bson/byte_buffer_spec.rb +1 -0
- data/spec/bson/byte_buffer_write_spec.rb +1 -0
- data/spec/bson/code_spec.rb +5 -3
- data/spec/bson/code_with_scope_spec.rb +5 -3
- data/spec/bson/config_spec.rb +1 -35
- data/spec/bson/date_spec.rb +1 -0
- data/spec/bson/date_time_spec.rb +1 -0
- data/spec/bson/dbref_legacy_spec.rb +20 -3
- data/spec/bson/dbref_spec.rb +9 -9
- data/spec/bson/decimal128_spec.rb +249 -14
- data/spec/bson/document_as_spec.rb +1 -0
- data/spec/bson/document_spec.rb +1 -1
- data/spec/bson/ext_json_parse_spec.rb +1 -0
- data/spec/bson/false_class_spec.rb +8 -0
- data/spec/bson/float_spec.rb +8 -3
- data/spec/bson/hash_as_spec.rb +1 -0
- data/spec/bson/hash_spec.rb +87 -75
- data/spec/bson/int32_spec.rb +21 -6
- data/spec/bson/int64_spec.rb +21 -6
- data/spec/bson/integer_spec.rb +45 -13
- data/spec/bson/json_spec.rb +1 -0
- data/spec/bson/max_key_spec.rb +5 -3
- data/spec/bson/min_key_spec.rb +5 -3
- data/spec/bson/nil_class_spec.rb +1 -0
- data/spec/bson/object_id_spec.rb +43 -4
- data/spec/bson/object_spec.rb +2 -1
- data/spec/bson/open_struct_spec.rb +14 -71
- data/spec/bson/raw_spec.rb +9 -15
- data/spec/bson/regexp_spec.rb +4 -3
- data/spec/bson/registry_spec.rb +2 -1
- data/spec/bson/string_spec.rb +13 -38
- data/spec/bson/symbol_raw_spec.rb +25 -0
- data/spec/bson/symbol_spec.rb +15 -18
- data/spec/bson/time_spec.rb +1 -0
- data/spec/bson/time_with_zone_spec.rb +1 -0
- data/spec/bson/timestamp_spec.rb +1 -0
- data/spec/bson/true_class_spec.rb +8 -0
- data/spec/bson/undefined_spec.rb +27 -0
- data/spec/bson_spec.rb +1 -0
- data/spec/runners/common_driver.rb +6 -5
- data/spec/runners/corpus.rb +6 -0
- data/spec/runners/corpus_legacy.rb +1 -0
- data/spec/shared/lib/mrss/constraints.rb +8 -16
- data/spec/shared/lib/mrss/docker_runner.rb +30 -3
- data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
- data/spec/shared/lib/mrss/event_subscriber.rb +15 -5
- data/spec/shared/lib/mrss/lite_constraints.rb +48 -1
- data/spec/shared/lib/mrss/server_version_registry.rb +16 -23
- data/spec/shared/lib/mrss/session_registry.rb +69 -0
- data/spec/shared/lib/mrss/session_registry_legacy.rb +60 -0
- data/spec/shared/lib/mrss/utils.rb +28 -6
- data/spec/shared/share/Dockerfile.erb +68 -85
- data/spec/shared/shlib/config.sh +27 -0
- data/spec/shared/shlib/server.sh +73 -24
- data/spec/shared/shlib/set_env.sh +39 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/spec_tests/common_driver_spec.rb +9 -4
- data/spec/spec_tests/corpus_legacy_spec.rb +1 -0
- data/spec/spec_tests/corpus_spec.rb +13 -3
- data/spec/spec_tests/data/corpus/binary.json +5 -0
- data/spec/spec_tests/data/corpus/code.json +13 -13
- data/spec/spec_tests/data/corpus/decimal128-4.json +48 -0
- data/spec/spec_tests/data/corpus/decimal128-6.json +12 -0
- data/spec/spec_tests/data/corpus/decimal128-7.json +4 -0
- data/spec/spec_tests/data/corpus/document.json +20 -0
- data/spec/spec_tests/data/corpus/symbol.json +7 -7
- data/spec/spec_tests/data/corpus/top.json +18 -3
- data/spec/support/shared_examples.rb +28 -5
- data/spec/support/spec_config.rb +1 -0
- data/spec/support/utils.rb +49 -1
- data.tar.gz.sig +0 -0
- metadata +167 -143
- metadata.gz.sig +0 -0
@@ -24,6 +24,21 @@ module Mrss
|
|
24
24
|
|
25
25
|
attr_reader :desired_version, :arch
|
26
26
|
|
27
|
+
def target_arch
|
28
|
+
# can't use RbConfig::CONFIG["arch"] because JRuby doesn't
|
29
|
+
# return anything meaningful there.
|
30
|
+
#
|
31
|
+
# also, need to use `uname -a` instead of (e.g.) `uname -p`
|
32
|
+
# because debian (at least) does not return anything meaningful
|
33
|
+
# for `uname -p`.
|
34
|
+
uname = `uname -a`.strip
|
35
|
+
@target_arch ||= case uname
|
36
|
+
when /aarch/ then "aarch64"
|
37
|
+
when /x86/ then "x86_64"
|
38
|
+
else raise "unsupported architecture #{uname.inspect}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
27
42
|
def download_url
|
28
43
|
@download_url ||= begin
|
29
44
|
version, version_ok = detect_version(current_catalog)
|
@@ -40,35 +55,13 @@ module Mrss
|
|
40
55
|
end
|
41
56
|
dl = version['downloads'].detect do |dl|
|
42
57
|
dl['archive']['url'].index("enterprise-#{arch}") &&
|
43
|
-
dl['arch'] ==
|
58
|
+
dl['arch'] == target_arch
|
44
59
|
end
|
45
60
|
unless dl
|
46
61
|
raise MissingDownloadUrl, "No download for #{arch} for #{version['version']}"
|
47
62
|
end
|
48
63
|
url = dl['archive']['url']
|
49
64
|
end
|
50
|
-
rescue MissingDownloadUrl
|
51
|
-
if %w(2.6 3.0).include?(desired_version) && arch == 'ubuntu1604'
|
52
|
-
# 2.6 and 3.0 are only available for ubuntu1204 and ubuntu1404.
|
53
|
-
# Those ubuntus have ancient Pythons that don't work due to not
|
54
|
-
# implementing recent TLS protocols.
|
55
|
-
# Because of this we test on ubuntu1604 which has a newer Python.
|
56
|
-
# But we still need to retrieve ubuntu1404-targeting builds.
|
57
|
-
url = self.class.new('3.2', arch).download_url
|
58
|
-
unless url.include?('3.2.')
|
59
|
-
raise 'URL not in expected format'
|
60
|
-
end
|
61
|
-
url = case desired_version
|
62
|
-
when '2.6'
|
63
|
-
url.sub(/\b3\.2\.\d+/, '2.6.12')
|
64
|
-
when '3.0'
|
65
|
-
url.sub(/\b3\.2\.\d+/, '3.0.15')
|
66
|
-
else
|
67
|
-
raise NotImplementedError
|
68
|
-
end.sub('ubuntu1604', 'ubuntu1404')
|
69
|
-
else
|
70
|
-
raise
|
71
|
-
end
|
72
65
|
end
|
73
66
|
|
74
67
|
private
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'singleton'
|
5
|
+
|
6
|
+
module Mrss
|
7
|
+
|
8
|
+
def self.patch_mongo_for_session_registry
|
9
|
+
|
10
|
+
Mongo::Client.class_eval do
|
11
|
+
alias :get_session_without_tracking :get_session
|
12
|
+
|
13
|
+
def get_session(options = {})
|
14
|
+
get_session_without_tracking(options).tap do |session|
|
15
|
+
SessionRegistry.instance.register(session) if session&.materialized?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Mongo::Session.class_eval do
|
21
|
+
alias :end_session_without_tracking :end_session
|
22
|
+
|
23
|
+
def end_session
|
24
|
+
SessionRegistry.instance.unregister(self)
|
25
|
+
end_session_without_tracking
|
26
|
+
end
|
27
|
+
|
28
|
+
alias :materialize_if_needed_without_tracking :materialize_if_needed
|
29
|
+
|
30
|
+
def materialize_if_needed
|
31
|
+
materialize_if_needed_without_tracking.tap do
|
32
|
+
SessionRegistry.instance.register(self)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
module Mrss
|
40
|
+
class SessionRegistry
|
41
|
+
include Singleton
|
42
|
+
|
43
|
+
def initialize
|
44
|
+
@registry = {}
|
45
|
+
end
|
46
|
+
|
47
|
+
def register(session)
|
48
|
+
@registry[session.session_id] = session if session
|
49
|
+
end
|
50
|
+
|
51
|
+
def unregister(session)
|
52
|
+
return if session.ended? || !session.materialized?
|
53
|
+
@registry.delete(session.session_id)
|
54
|
+
end
|
55
|
+
|
56
|
+
def verify_sessions_ended!
|
57
|
+
@registry.delete_if { |_, session| session.ended? }
|
58
|
+
|
59
|
+
unless @registry.empty?
|
60
|
+
sessions = @registry.map { |_, session| session }
|
61
|
+
raise "Session registry contains live sessions: #{sessions.join(', ')}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def clear_registry
|
66
|
+
@registry = {}
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'singleton'
|
5
|
+
|
6
|
+
module Mrss
|
7
|
+
|
8
|
+
def self.patch_mongo_for_session_registry
|
9
|
+
|
10
|
+
Mongo::Client.class_eval do
|
11
|
+
alias :get_session_without_tracking :get_session
|
12
|
+
|
13
|
+
def get_session(options = {})
|
14
|
+
get_session_without_tracking(options).tap do |session|
|
15
|
+
SessionRegistry.instance.register(session)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Mongo::Session.class_eval do
|
21
|
+
alias :end_session_without_tracking :end_session
|
22
|
+
|
23
|
+
def end_session
|
24
|
+
SessionRegistry.instance.unregister(self)
|
25
|
+
end_session_without_tracking
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module Mrss
|
32
|
+
class SessionRegistry
|
33
|
+
include Singleton
|
34
|
+
|
35
|
+
def initialize
|
36
|
+
@registry = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
def register(session)
|
40
|
+
@registry[session.session_id] = session if session
|
41
|
+
end
|
42
|
+
|
43
|
+
def unregister(session)
|
44
|
+
@registry.delete(session.session_id) unless session.ended?
|
45
|
+
end
|
46
|
+
|
47
|
+
def verify_sessions_ended!
|
48
|
+
@registry.delete_if { |_, session| session.ended? }
|
49
|
+
|
50
|
+
unless @registry.empty?
|
51
|
+
sessions = @registry.map { |_, session| session }
|
52
|
+
raise "Session registry contains live sessions: #{sessions.join(', ')}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def clear_registry
|
57
|
+
@registry = {}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -3,13 +3,35 @@
|
|
3
3
|
|
4
4
|
module Mrss
|
5
5
|
module Utils
|
6
|
+
extend self
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
def print_backtrace(dest=STDERR)
|
9
|
+
raise
|
10
|
+
rescue => e
|
11
|
+
dest.puts e.backtrace.join("\n")
|
12
|
+
end
|
13
|
+
|
14
|
+
# Parses the given version string, accounting for suffix information that
|
15
|
+
# Gem::Version cannot successfully parse.
|
16
|
+
#
|
17
|
+
# @param [ String ] version the version to parse
|
18
|
+
#
|
19
|
+
# @return [ Gem::Version ] the parsed version
|
20
|
+
#
|
21
|
+
# @raise [ ArgumentError ] if the string cannot be parsed.
|
22
|
+
def parse_version(version)
|
23
|
+
Gem::Version.new(version)
|
24
|
+
rescue ArgumentError
|
25
|
+
match = version.match(/\A(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)?(-[A-Za-z\+\d]+)?\z/)
|
26
|
+
raise ArgumentError.new("Malformed version number string #{version}") if match.nil?
|
27
|
+
|
28
|
+
Gem::Version.new(
|
29
|
+
[
|
30
|
+
match[:major],
|
31
|
+
match[:minor],
|
32
|
+
match[:patch]
|
33
|
+
].join('.')
|
34
|
+
)
|
13
35
|
end
|
14
36
|
end
|
15
37
|
end
|
@@ -7,23 +7,26 @@
|
|
7
7
|
<%
|
8
8
|
|
9
9
|
python_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-python-driver-toolchain/#{distro}/ba92de2700c04ee2d4f82c3ffdfc33105140cb04/mongo_python_driver_toolchain_#{distro.gsub('-', '_')}_ba92de2700c04ee2d4f82c3ffdfc33105140cb04_19_11_14_15_33_33.tar.gz"
|
10
|
-
server_version = '4.3.3'
|
10
|
+
# server_version = '4.3.3'
|
11
11
|
server_url = "http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-#{distro}-#{server_version}.tgz"
|
12
12
|
server_archive_basename = File.basename(server_url)
|
13
13
|
server_extracted_dir = server_archive_basename.sub(/\.(tar\.gz|tgz)$/, '')
|
14
14
|
|
15
|
-
|
15
|
+
# When changing, also update the hash in shlib/set_env.sh.
|
16
|
+
TOOLCHAIN_VERSION='e8c60866f54bed7e336a37df3a97d6ae1b971b7d'
|
16
17
|
|
17
18
|
def ruby_toolchain_url(ruby)
|
18
19
|
"http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/#{TOOLCHAIN_VERSION}/#{distro}/#{ruby}.tar.xz"
|
19
20
|
end
|
20
21
|
|
21
|
-
#ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{
|
22
|
+
#ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{TOOLCHAIN_VERSION}/mongo_ruby_driver_toolchain_#{distro.gsub('-', '_')}_patch_#{TOOLCHAIN_VERSION}_#{toolchain_lower}.tar.gz"
|
22
23
|
|
23
24
|
%>
|
24
25
|
|
25
26
|
FROM <%= base_image %>
|
26
27
|
|
28
|
+
ENV DOCKER=1
|
29
|
+
|
27
30
|
<% if debian? %>
|
28
31
|
|
29
32
|
ENV DEBIAN_FRONTEND=noninteractive
|
@@ -36,15 +39,10 @@ FROM <%= base_image %>
|
|
36
39
|
|
37
40
|
<% if ruby_head? %>
|
38
41
|
|
39
|
-
# To use current versions of mlaunch, Python 3.
|
40
|
-
#
|
42
|
+
# To use current versions of mlaunch, Python 3.7+ is required.
|
43
|
+
# Many distros ship with older Pythons, therefore we need to install
|
41
44
|
# a newer Python from somewhere. This section installs the Python
|
42
|
-
#
|
43
|
-
# Alternatively, Ruby toolchain compiles its own copy of Python 3 but
|
44
|
-
# this is currently incomplete in that on older distros with old OpenSSL,
|
45
|
-
# the built Python has no ssl module and hence practically is unusable.
|
46
|
-
# Currently Ruby driver uses mtools-legacy which supports Python 2,
|
47
|
-
# avoiding this entire issue for the time being.
|
45
|
+
# toolchain which comes with recent Pythons.
|
48
46
|
|
49
47
|
#RUN curl --retry 3 -fL <%= python_toolchain_url %> -o python-toolchain.tar.gz
|
50
48
|
#RUN tar -xC /opt -zf python-toolchain.tar.gz
|
@@ -57,7 +55,7 @@ FROM <%= base_image %>
|
|
57
55
|
# than bash.
|
58
56
|
# Ruby runtime dependencies: libyaml-0-2
|
59
57
|
# Compiling ruby libraries: gcc make
|
60
|
-
# Compiling
|
58
|
+
# Compiling python packages: python3-dev
|
61
59
|
# JRuby: openjdk-8-jdk-headless
|
62
60
|
# Server dependencies: libsnmp30 libcurl3/libcurl4
|
63
61
|
# Determining OS we are running on: lsb-release
|
@@ -79,34 +77,31 @@ FROM <%= base_image %>
|
|
79
77
|
# therefore install python-pip in all configurations here.
|
80
78
|
|
81
79
|
<% packages = %w(
|
82
|
-
procps lsb-release bzip2 curl zsh
|
80
|
+
procps lsb-release bzip2 curl wget gpg zsh
|
83
81
|
git make gcc libyaml-0-2 libgmp-dev zlib1g-dev libsnappy-dev
|
84
82
|
krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
|
85
83
|
haproxy
|
86
84
|
python3-pip
|
87
|
-
tzdata shared-mime-info
|
85
|
+
tzdata shared-mime-info software-properties-common
|
88
86
|
) %>
|
89
87
|
|
90
|
-
<% if distro =~ /ubuntu1404/ %>
|
91
|
-
# For building python & setuptools
|
92
|
-
<% packages += %w(libssl-dev unzip) %>
|
93
|
-
<% end %>
|
94
|
-
|
95
|
-
<% if distro !~ /ubuntu2004/ %>
|
96
|
-
<% packages += %w(python2.7-dev) %>
|
97
|
-
<% end %>
|
98
|
-
|
99
88
|
<% if distro =~ /ubuntu2004/ %>
|
100
89
|
<% packages << 'libsnmp35' %>
|
90
|
+
<% elsif distro =~ /ubuntu2204|debian11/ %>
|
91
|
+
<% packages << 'libsnmp40' %>
|
101
92
|
<% else %>
|
102
93
|
<% packages << 'libsnmp30' %>
|
103
94
|
<% end %>
|
104
95
|
|
105
|
-
<% if distro !~ /ubuntu2004/ %>
|
96
|
+
<% if distro !~ /ubuntu2004|ubuntu2204|debian11/ %>
|
106
97
|
<% packages << 'python-pip' %>
|
107
98
|
<% end %>
|
108
99
|
|
109
|
-
<% if distro =~ /
|
100
|
+
<% if distro =~ /ubuntu2204|debian11/ %>
|
101
|
+
<% packages << 'python3-venv' %>
|
102
|
+
<% end %>
|
103
|
+
|
104
|
+
<% if distro =~ /debian10|ubuntu2204|debian11/ %>
|
110
105
|
<% packages << 'openjdk-11-jdk-headless' %>
|
111
106
|
<% elsif distro =~ /ubuntu1404/ %>
|
112
107
|
# Ubuntu 14.04 only has openjdk 7, this is too old to be useful
|
@@ -116,30 +111,37 @@ FROM <%= base_image %>
|
|
116
111
|
|
117
112
|
# ubuntu1404, ubuntu1604: libcurl3
|
118
113
|
# ubuntu1804, ubuntu2004, debian10: libcurl4
|
119
|
-
<% if distro =~ /ubuntu1804|ubuntu2004|debian10/ %>
|
114
|
+
<% if distro =~ /ubuntu1804|ubuntu2004|ubuntu2204|debian10|debian11/ %>
|
120
115
|
<% packages << 'libcurl4' %>
|
121
116
|
<% else %>
|
122
117
|
<% packages << 'libcurl3' %>
|
123
118
|
<% end %>
|
124
119
|
|
125
|
-
<% if distro =~ /ubuntu1804/ %>
|
120
|
+
<% if distro =~ /ubuntu1804|ubuntu2004|ubuntu2204/ %>
|
126
121
|
<% packages << 'nodejs' %>
|
127
122
|
<% end %>
|
128
123
|
|
129
|
-
<% if distro =~ /ubuntu2004/ %>
|
130
|
-
<% packages += %w(ruby
|
124
|
+
<% if distro =~ /ubuntu2004|ubuntu2204/ %>
|
125
|
+
<% packages += %w(ruby bundler) %>
|
131
126
|
<% end %>
|
132
127
|
|
133
128
|
RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
|
129
|
+
|
130
|
+
<% if ubuntu? %>
|
131
|
+
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
|
132
|
+
RUN echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null
|
133
|
+
<% end %>
|
134
|
+
RUN apt-get update && apt-get install -y cmake
|
135
|
+
|
134
136
|
<% else %>
|
135
137
|
|
136
138
|
<% if distro =~ /rhel6/ %>
|
137
|
-
|
139
|
+
|
138
140
|
# CentOS 6 is dead - to use it retrieve the packages from vault:
|
139
141
|
# https://stackoverflow.com/questions/53562691/error-cannot-retrieve-repository-metadata-repomd-xml-for-repository-base-pl
|
140
|
-
|
142
|
+
|
141
143
|
<%
|
142
|
-
|
144
|
+
|
143
145
|
cfg = <<-CFG
|
144
146
|
[base]
|
145
147
|
name=CentOS-$releasever - Base
|
@@ -151,11 +153,11 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
|
151
153
|
CFG
|
152
154
|
|
153
155
|
%>
|
154
|
-
|
156
|
+
|
155
157
|
RUN printf "<%= cfg.gsub("\n", "\\n") %>" >/etc/yum.repos.d/CentOS-Base.repo
|
156
|
-
|
158
|
+
|
157
159
|
<% end %>
|
158
|
-
|
160
|
+
|
159
161
|
# Enterprise server: net-snmp
|
160
162
|
# lsb_release: redhat-lsb-core
|
161
163
|
# our runner scripts: which
|
@@ -172,48 +174,19 @@ CFG
|
|
172
174
|
|
173
175
|
RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
|
174
176
|
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
|
175
|
-
net-snmp
|
176
|
-
|
177
|
-
<% if distro =~ /rhel6/ %>
|
178
|
-
|
179
|
-
# RHEL 6 ships with Python 2.6.
|
180
|
-
|
181
|
-
RUN yum install -y centos-release-scl && \
|
182
|
-
yum install -y python27-python python27-python-devel
|
183
|
-
ENV PATH=/opt/rh/python27/root/usr/bin:$PATH \
|
184
|
-
LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64
|
185
|
-
|
186
|
-
<% else %>
|
177
|
+
net-snmp python38 python38-devel cmake nodejs
|
187
178
|
|
188
|
-
RUN yum install -y python-devel
|
189
|
-
|
190
|
-
<% end %>
|
191
|
-
|
192
179
|
<% end %>
|
193
180
|
|
194
181
|
<% if preload? %>
|
195
182
|
|
196
|
-
<% if distro =~ /
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
./configure && \
|
204
|
-
nice make -j4 && \
|
205
|
-
make install && \
|
206
|
-
cd .. && rm -rf Python-2.7.16
|
207
|
-
|
208
|
-
ENV PATH=/usr/local/bin:$PATH
|
209
|
-
|
210
|
-
RUN curl --retry 3 -fL -o setuptools-44.1.1.zip https://files.pythonhosted.org/packages/b2/40/4e00501c204b457f10fe410da0c97537214b2265247bc9a5bc6edd55b9e4/setuptools-44.1.1.zip && \
|
211
|
-
unzip setuptools-44.1.1.zip && \
|
212
|
-
cd setuptools-44.1.1 && \
|
213
|
-
python setup.py install && \
|
214
|
-
cd .. && rm -rf setuptools-44.1.1
|
215
|
-
|
216
|
-
<% end%>
|
183
|
+
<% if distro =~ /debian9|ubuntu1604|ubuntu1804/ %>
|
184
|
+
# Install python 3.7 for mlaunch.
|
185
|
+
RUN curl -fL --retry 3 https://github.com/p-mongodb/deps/raw/main/<%= distro %>-python37.tar.xz | \
|
186
|
+
tar xfJ - -C /opt
|
187
|
+
ENV PATH=/opt/python37/bin:$PATH
|
188
|
+
RUN python3 -V
|
189
|
+
<% end %>
|
217
190
|
|
218
191
|
<% if true || distro =~ /rhel|ubuntu1604/ %>
|
219
192
|
|
@@ -229,25 +202,36 @@ CFG
|
|
229
202
|
# therefore install it the manual way.
|
230
203
|
#
|
231
204
|
# https://pip.pypa.io/en/stable/installing/
|
232
|
-
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/
|
205
|
+
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/get-pip.py | python3
|
206
|
+
RUN python3 -m pip install --upgrade pip setuptools wheel
|
233
207
|
|
234
208
|
<% end %>
|
235
209
|
|
236
210
|
# Current virtualenv fails with
|
237
211
|
# https://github.com/pypa/virtualenv/issues/1630
|
238
|
-
<%
|
239
|
-
|
212
|
+
<% mtools = 'legacy' %>
|
213
|
+
<% case mtools
|
214
|
+
when 'legacy' %>
|
215
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
216
|
+
RUN python3 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
|
217
|
+
<% when 'git' %>
|
218
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
219
|
+
RUN python3 -m pip install virtualenv 'pymongo>=4' python-dateutil psutil
|
220
|
+
|
221
|
+
# Install mtools from git because released versions do not work with pymongo 4.0
|
222
|
+
RUN git clone https://github.com/p-mongodb/mtools && \
|
223
|
+
cd mtools && \
|
224
|
+
python3 setup.py install
|
240
225
|
<% else %>
|
241
|
-
|
226
|
+
# mtools[mlaunch] does not work: https://github.com/rueckstiess/mtools/issues/856
|
227
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
228
|
+
RUN python3 -m pip install virtualenv 'pymongo>=4' python-dateutil psutil mtools
|
242
229
|
<% end %>
|
243
230
|
|
244
|
-
RUN pip --version && \
|
245
|
-
pip install mtools-legacy[mlaunch]
|
246
|
-
|
247
231
|
<% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
|
248
232
|
# ubuntu1604 installs MarkupSafe 0.0.0 here instead of 2.0.0+
|
249
233
|
# as specified by dependencies, causing OCSP mock to not work.
|
250
|
-
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
|
234
|
+
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade --ignore-installed
|
251
235
|
<% end %>
|
252
236
|
|
253
237
|
# FLE is tested against 4.0+ servers.
|
@@ -256,7 +240,7 @@ CFG
|
|
256
240
|
# boto3~=1.19 cryptography~=3.4.8 pykmip~=0.10.0
|
257
241
|
# cryptography does not install due to lacking setuptools_rust
|
258
242
|
# (either that version or anything that isn't part of system packages)
|
259
|
-
RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0
|
243
|
+
RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0 'sqlalchemy<2.0.0'
|
260
244
|
<% end %>
|
261
245
|
|
262
246
|
<% unless ruby_head? || system_ruby? %>
|
@@ -268,10 +252,6 @@ CFG
|
|
268
252
|
|
269
253
|
<% end %>
|
270
254
|
|
271
|
-
RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
|
272
|
-
mv mongo*/ /opt/mongodb
|
273
|
-
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
274
|
-
|
275
255
|
<% end %>
|
276
256
|
|
277
257
|
<% if distro =~ /debian|ubuntu/ %>
|
@@ -321,6 +301,9 @@ ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
|
|
321
301
|
|
322
302
|
COPY . .
|
323
303
|
|
304
|
+
RUN bash -c '. .evergreen/download-mongodb.sh && get_distro && get_mongodb_download_url_for "$DISTRO" "<%= server_version %>" && curl --retry 3 -fL $MONGODB_DOWNLOAD_URL |tar xzf - && mv mongo*/ /opt/mongodb'
|
305
|
+
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
306
|
+
|
324
307
|
<% if expose? %>
|
325
308
|
|
326
309
|
<% ports = [] %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
show_local_instructions_impl() {
|
2
|
+
local arch="$1"
|
3
|
+
shift
|
4
|
+
|
5
|
+
echo To test this configuration locally:
|
6
|
+
local params=
|
7
|
+
while test -n "$1"; do
|
8
|
+
key="$1"
|
9
|
+
shift
|
10
|
+
# ${!foo} syntax is bash specific:
|
11
|
+
# https://stackoverflow.com/questions/14049057/bash-expand-variable-in-a-variable
|
12
|
+
value="${!key}"
|
13
|
+
if test -n "$value"; then
|
14
|
+
params="$params $key=$value"
|
15
|
+
fi
|
16
|
+
done
|
17
|
+
|
18
|
+
# $0 has the current script being executed which is also the script that
|
19
|
+
# was initially invoked EXCEPT for the AWS configurations which use the
|
20
|
+
# wrapper script.
|
21
|
+
if echo "$AUTH" |grep -q ^aws; then
|
22
|
+
script=.evergreen/run-tests-aws-auth.sh
|
23
|
+
else
|
24
|
+
script="$0"
|
25
|
+
fi
|
26
|
+
echo ./.evergreen/test-on-docker -d $arch $params -s "$script"
|
27
|
+
}
|