bson 4.15.0 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +94 -10
- data/Rakefile +68 -39
- 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 +39 -9
- data/ext/bson/util.c +171 -16
- data/ext/bson/write.c +34 -39
- data/lib/bson/active_support.rb +1 -0
- data/lib/bson/array.rb +58 -32
- data/lib/bson/big_decimal.rb +16 -6
- data/lib/bson/binary.rb +271 -129
- data/lib/bson/boolean.rb +1 -0
- data/lib/bson/code.rb +10 -12
- data/lib/bson/code_with_scope.rb +9 -11
- 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 +12 -13
- data/lib/bson/dbref.rb +11 -9
- data/lib/bson/decimal128/builder.rb +10 -9
- data/lib/bson/decimal128.rb +25 -111
- 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 +2 -1
- data/lib/bson/false_class.rb +2 -1
- data/lib/bson/float.rb +3 -2
- data/lib/bson/hash.rb +128 -73
- data/lib/bson/int32.rb +17 -5
- data/lib/bson/int64.rb +17 -5
- data/lib/bson/integer.rb +4 -5
- data/lib/bson/json.rb +1 -0
- data/lib/bson/max_key.rb +8 -10
- data/lib/bson/min_key.rb +8 -10
- data/lib/bson/nil_class.rb +1 -0
- data/lib/bson/object.rb +7 -27
- data/lib/bson/object_id.rb +84 -120
- data/lib/bson/open_struct.rb +3 -2
- data/lib/bson/regexp.rb +36 -65
- 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 +23 -20
- data/lib/bson/time.rb +3 -2
- data/lib/bson/time_with_zone.rb +13 -1
- data/lib/bson/timestamp.rb +3 -2
- data/lib/bson/true_class.rb +2 -1
- data/lib/bson/undefined.rb +15 -1
- data/lib/bson/version.rb +3 -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 +129 -81
- 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 +40 -20
- 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 +57 -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/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
- metadata +114 -164
- checksums.yaml.gz.sig +0 -0
- data/spec/shared/LICENSE +0 -20
- data/spec/shared/bin/get-mongodb-download-url +0 -17
- data/spec/shared/bin/s3-copy +0 -45
- data/spec/shared/bin/s3-upload +0 -69
- data/spec/shared/lib/mrss/child_process_helper.rb +0 -80
- data/spec/shared/lib/mrss/cluster_config.rb +0 -231
- data/spec/shared/lib/mrss/constraints.rb +0 -386
- data/spec/shared/lib/mrss/docker_runner.rb +0 -271
- data/spec/shared/lib/mrss/event_subscriber.rb +0 -200
- data/spec/shared/lib/mrss/lite_constraints.rb +0 -191
- data/spec/shared/lib/mrss/server_version_registry.rb +0 -120
- data/spec/shared/lib/mrss/spec_organizer.rb +0 -179
- data/spec/shared/lib/mrss/utils.rb +0 -15
- data/spec/shared/share/Dockerfile.erb +0 -338
- data/spec/shared/share/haproxy-1.conf +0 -16
- data/spec/shared/share/haproxy-2.conf +0 -17
- data/spec/shared/shlib/distro.sh +0 -74
- data/spec/shared/shlib/server.sh +0 -367
- data/spec/shared/shlib/set_env.sh +0 -131
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
@@ -1,120 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
autoload :JSON, 'json'
|
5
|
-
require 'open-uri'
|
6
|
-
|
7
|
-
module Mrss
|
8
|
-
class ServerVersionRegistry
|
9
|
-
class Error < StandardError
|
10
|
-
end
|
11
|
-
|
12
|
-
class UnknownVersion < Error
|
13
|
-
end
|
14
|
-
|
15
|
-
class MissingDownloadUrl < Error
|
16
|
-
end
|
17
|
-
|
18
|
-
class BrokenDownloadUrl < Error
|
19
|
-
end
|
20
|
-
|
21
|
-
def initialize(desired_version, arch)
|
22
|
-
@desired_version, @arch = desired_version, arch
|
23
|
-
end
|
24
|
-
|
25
|
-
attr_reader :desired_version, :arch
|
26
|
-
|
27
|
-
def download_url
|
28
|
-
@download_url ||= begin
|
29
|
-
version, version_ok = detect_version(current_catalog)
|
30
|
-
if version.nil?
|
31
|
-
version, full_version_ok = detect_version(full_catalog)
|
32
|
-
version_ok ||= full_version_ok
|
33
|
-
end
|
34
|
-
if version.nil?
|
35
|
-
if version_ok
|
36
|
-
raise MissingDownloadUrl, "No downloads for version #{desired_version}"
|
37
|
-
else
|
38
|
-
raise UnknownVersion, "No version #{desired_version}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
dl = version['downloads'].detect do |dl|
|
42
|
-
dl['archive']['url'].index("enterprise-#{arch}") &&
|
43
|
-
dl['arch'] == 'x86_64'
|
44
|
-
end
|
45
|
-
unless dl
|
46
|
-
raise MissingDownloadUrl, "No download for #{arch} for #{version['version']}"
|
47
|
-
end
|
48
|
-
url = dl['archive']['url']
|
49
|
-
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
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
def uri_open(*args)
|
77
|
-
if RUBY_VERSION < '2.5'
|
78
|
-
open(*args)
|
79
|
-
else
|
80
|
-
URI.open(*args)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def detect_version(catalog)
|
85
|
-
candidate_versions = catalog['versions'].select do |version|
|
86
|
-
version['version'].start_with?(desired_version) &&
|
87
|
-
!version['version'].include?('-')
|
88
|
-
end
|
89
|
-
version_ok = !candidate_versions.empty?
|
90
|
-
# Sometimes the download situation is borked and there is a release
|
91
|
-
# with no downloads... skip those.
|
92
|
-
version = candidate_versions.detect do |version|
|
93
|
-
!version['downloads'].empty?
|
94
|
-
end
|
95
|
-
# Allow RC releases if there isn't a GA release.
|
96
|
-
if version.nil?
|
97
|
-
candidate_versions = catalog['versions'].select do |version|
|
98
|
-
version['version'].start_with?(desired_version)
|
99
|
-
end
|
100
|
-
version_ok ||= !candidate_versions.empty?
|
101
|
-
version = candidate_versions.detect do |version|
|
102
|
-
!version['downloads'].empty?
|
103
|
-
end
|
104
|
-
end
|
105
|
-
[version, version_ok]
|
106
|
-
end
|
107
|
-
|
108
|
-
def current_catalog
|
109
|
-
@current_catalog ||= begin
|
110
|
-
JSON.load(uri_open('http://downloads.mongodb.org/current.json').read)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def full_catalog
|
115
|
-
@full_catalog ||= begin
|
116
|
-
JSON.load(uri_open('http://downloads.mongodb.org/full.json').read)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
@@ -1,179 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
autoload :JSON, 'json'
|
5
|
-
autoload :FileUtils, 'fileutils'
|
6
|
-
autoload :Find, 'find'
|
7
|
-
|
8
|
-
module Mrss
|
9
|
-
|
10
|
-
autoload :ChildProcessHelper, 'mrss/child_process_helper'
|
11
|
-
|
12
|
-
# Organizes and runs all of the tests in the test suite in batches.
|
13
|
-
#
|
14
|
-
# Organizing the tests in batches serves two purposes:
|
15
|
-
#
|
16
|
-
# 1. This allows running unit tests before integration tests, therefore
|
17
|
-
# in theory revealing failures quicker on average.
|
18
|
-
# 2. This allows running some tests that have high intermittent failure rate
|
19
|
-
# in their own test process.
|
20
|
-
#
|
21
|
-
# This class aggregates RSpec results after the test runs.
|
22
|
-
class SpecOrganizer
|
23
|
-
|
24
|
-
class BucketsNotPrioritized < StandardError
|
25
|
-
end
|
26
|
-
|
27
|
-
def initialize(root: nil, classifiers:, priority_order:,
|
28
|
-
spec_root: nil, rspec_json_path: nil, rspec_all_json_path: nil,
|
29
|
-
randomize: false
|
30
|
-
)
|
31
|
-
@spec_root = spec_root || File.join(root, 'spec')
|
32
|
-
@classifiers = classifiers
|
33
|
-
@priority_order = priority_order
|
34
|
-
@rspec_json_path = rspec_json_path || File.join(root, 'tmp/rspec.json')
|
35
|
-
@rspec_all_json_path = rspec_all_json_path || File.join(root, 'tmp/rspec-all.json')
|
36
|
-
@randomize = !!randomize
|
37
|
-
end
|
38
|
-
|
39
|
-
attr_reader :spec_root, :classifiers, :priority_order
|
40
|
-
attr_reader :rspec_json_path, :rspec_all_json_path
|
41
|
-
|
42
|
-
def randomize?
|
43
|
-
@randomize
|
44
|
-
end
|
45
|
-
|
46
|
-
def seed
|
47
|
-
@seed ||= (rand * 100_000).to_i
|
48
|
-
end
|
49
|
-
|
50
|
-
def buckets
|
51
|
-
@buckets ||= {}.tap do |buckets|
|
52
|
-
Find.find(spec_root) do |path|
|
53
|
-
next unless File.file?(path)
|
54
|
-
next unless path =~ /_spec\.rb\z/
|
55
|
-
rel_path = path[(spec_root.length + 1)..path.length]
|
56
|
-
|
57
|
-
found = false
|
58
|
-
classifiers.each do |(regexp, category)|
|
59
|
-
if regexp =~ rel_path
|
60
|
-
buckets[category] ||= []
|
61
|
-
buckets[category] << File.join('spec', rel_path)
|
62
|
-
found = true
|
63
|
-
break
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
unless found
|
68
|
-
buckets[nil] ||= []
|
69
|
-
buckets[nil] << File.join('spec', rel_path)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end.freeze
|
73
|
-
end
|
74
|
-
|
75
|
-
def ordered_buckets
|
76
|
-
@ordered_buckets ||= {}.tap do |ordered_buckets|
|
77
|
-
buckets = self.buckets.dup
|
78
|
-
priority_order.each do |category|
|
79
|
-
files = buckets.delete(category)
|
80
|
-
ordered_buckets[category] = files
|
81
|
-
end
|
82
|
-
|
83
|
-
if files = buckets.delete(nil)
|
84
|
-
ordered_buckets[nil] = files
|
85
|
-
end
|
86
|
-
|
87
|
-
unless buckets.empty?
|
88
|
-
raise BucketsNotPrioritized, "Some buckets were not prioritized: #{buckets.keys.map(&:to_s).join(', ')}"
|
89
|
-
end
|
90
|
-
end.freeze
|
91
|
-
end
|
92
|
-
|
93
|
-
def run
|
94
|
-
run_buckets(*buckets.keys)
|
95
|
-
end
|
96
|
-
|
97
|
-
def run_buckets(*buckets)
|
98
|
-
FileUtils.rm_f(rspec_all_json_path)
|
99
|
-
|
100
|
-
buckets.each do |bucket|
|
101
|
-
if bucket && !self.buckets[bucket]
|
102
|
-
raise "Unknown bucket #{bucket}"
|
103
|
-
end
|
104
|
-
end
|
105
|
-
buckets = Hash[self.buckets.select { |k, v| buckets.include?(k) }]
|
106
|
-
|
107
|
-
failed = []
|
108
|
-
|
109
|
-
priority_order.each do |category|
|
110
|
-
if files = buckets.delete(category)
|
111
|
-
unless run_files(category, files)
|
112
|
-
failed << category
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
if files = buckets.delete(nil)
|
117
|
-
unless run_files('remaining', files)
|
118
|
-
failed << 'remaining'
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
unless buckets.empty?
|
123
|
-
raise "Some buckets were not executed: #{buckets.keys.map(&:to_s).join(', ')}"
|
124
|
-
end
|
125
|
-
|
126
|
-
if failed.any?
|
127
|
-
raise "The following buckets failed: #{failed.map(&:to_s).join(', ')}"
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
def run_files(category, paths)
|
132
|
-
puts "Running #{category.to_s.gsub('_', ' ')} tests"
|
133
|
-
FileUtils.rm_f(rspec_json_path)
|
134
|
-
cmd = %w(rspec) + paths
|
135
|
-
if randomize?
|
136
|
-
cmd += %W(--order rand:#{seed})
|
137
|
-
end
|
138
|
-
|
139
|
-
begin
|
140
|
-
puts "Running #{cmd.join(' ')}"
|
141
|
-
ChildProcessHelper.check_call(cmd)
|
142
|
-
ensure
|
143
|
-
if File.exist?(rspec_json_path)
|
144
|
-
if File.exist?(rspec_all_json_path)
|
145
|
-
merge_rspec_results
|
146
|
-
else
|
147
|
-
FileUtils.cp(rspec_json_path, rspec_all_json_path)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
true
|
153
|
-
rescue ChildProcessHelper::SpawnError
|
154
|
-
false
|
155
|
-
end
|
156
|
-
|
157
|
-
def merge_rspec_results
|
158
|
-
all = JSON.parse(File.read(rspec_all_json_path))
|
159
|
-
new = JSON.parse(File.read(rspec_json_path))
|
160
|
-
all['examples'] += new.delete('examples')
|
161
|
-
new.delete('summary').each do |k, v|
|
162
|
-
all['summary'][k] += v
|
163
|
-
end
|
164
|
-
new.delete('version')
|
165
|
-
new.delete('summary_line')
|
166
|
-
# The spec organizer runs all buckets with the same seed, hence
|
167
|
-
# we can drop the seed from new results.
|
168
|
-
new.delete('seed')
|
169
|
-
unless new.empty?
|
170
|
-
raise "Unhandled rspec results keys: #{new.keys.join(', ')}"
|
171
|
-
end
|
172
|
-
# We do not merge summary lines, delete them from aggregated results
|
173
|
-
all.delete('summary_line')
|
174
|
-
File.open(rspec_all_json_path, 'w') do |f|
|
175
|
-
f << JSON.dump(all)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
@@ -1,338 +0,0 @@
|
|
1
|
-
# Python toolchain as of this writing is available on rhel62, debian92 and
|
2
|
-
# ubuntu1604.
|
3
|
-
#
|
4
|
-
# To run rhel62 in docker, host system must be configured to emulate syscalls:
|
5
|
-
# https://github.com/CentOS/sig-cloud-instance-images/issues/103
|
6
|
-
|
7
|
-
<%
|
8
|
-
|
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'
|
11
|
-
server_url = "http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-#{distro}-#{server_version}.tgz"
|
12
|
-
server_archive_basename = File.basename(server_url)
|
13
|
-
server_extracted_dir = server_archive_basename.sub(/\.(tar\.gz|tgz)$/, '')
|
14
|
-
|
15
|
-
TOOLCHAIN_VERSION='35fb9fb797a941094bf4ee8678284da88849435c'
|
16
|
-
|
17
|
-
def ruby_toolchain_url(ruby)
|
18
|
-
"http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/#{TOOLCHAIN_VERSION}/#{distro}/#{ruby}.tar.xz"
|
19
|
-
end
|
20
|
-
|
21
|
-
#ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{toolchain_upper}/mongo_ruby_driver_toolchain_#{distro.gsub('-', '_')}_patch_#{toolchain_upper}_#{toolchain_lower}.tar.gz"
|
22
|
-
|
23
|
-
%>
|
24
|
-
|
25
|
-
FROM <%= base_image %>
|
26
|
-
|
27
|
-
<% if debian? %>
|
28
|
-
|
29
|
-
ENV DEBIAN_FRONTEND=noninteractive
|
30
|
-
|
31
|
-
<% else %>
|
32
|
-
|
33
|
-
RUN echo assumeyes=1 |tee -a /etc/yum.conf
|
34
|
-
|
35
|
-
<% end %>
|
36
|
-
|
37
|
-
<% if ruby_head? %>
|
38
|
-
|
39
|
-
# To use current versions of mlaunch, Python 3.6+ is required.
|
40
|
-
# Most distros ship with older Pythons, therefore we need to install
|
41
|
-
# a newer Python from somewhere. This section installs the Python
|
42
|
-
# toolhcain which comes with recent Pythons.
|
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.
|
48
|
-
|
49
|
-
#RUN curl --retry 3 -fL <%= python_toolchain_url %> -o python-toolchain.tar.gz
|
50
|
-
#RUN tar -xC /opt -zf python-toolchain.tar.gz
|
51
|
-
|
52
|
-
<% end %>
|
53
|
-
|
54
|
-
<% if debian? %>
|
55
|
-
|
56
|
-
# zsh is not required for any scripts but it is a better interactive shell
|
57
|
-
# than bash.
|
58
|
-
# Ruby runtime dependencies: libyaml-0-2
|
59
|
-
# Compiling ruby libraries: gcc make
|
60
|
-
# Compiling pyhton packages: python2.7-dev
|
61
|
-
# JRuby: openjdk-8-jdk-headless
|
62
|
-
# Server dependencies: libsnmp30 libcurl3/libcurl4
|
63
|
-
# Determining OS we are running on: lsb-release
|
64
|
-
# Load balancer testing: haproxy
|
65
|
-
# Kerberos testing: krb5-user
|
66
|
-
# Local Kerberos server: krb5-kdc krb5-admin-server
|
67
|
-
# Installing mlaunch from git: git
|
68
|
-
# ruby-head archive: bzip2
|
69
|
-
# nio4r on JRuby: libgmp-dev
|
70
|
-
# Snappy compression: libsnappy-dev
|
71
|
-
# nokogiri: zlib1g-dev
|
72
|
-
# Mongoid testing: tzdata shared-mime-info
|
73
|
-
# Mongoid application testing: nodejs (8.x or newer)
|
74
|
-
# Test suite: procps for ps (to kill JRubies)
|
75
|
-
#
|
76
|
-
# We currently use Python 2-compatible version of mtools, which
|
77
|
-
# is installable via pip (which uses Python 2). All of the MongoDB
|
78
|
-
# distros have pip installed (but none as of this writing have pip3)
|
79
|
-
# therefore install python-pip in all configurations here.
|
80
|
-
|
81
|
-
<% packages = %w(
|
82
|
-
procps lsb-release bzip2 curl zsh
|
83
|
-
git make gcc libyaml-0-2 libgmp-dev zlib1g-dev libsnappy-dev
|
84
|
-
krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
|
85
|
-
haproxy
|
86
|
-
python3-pip
|
87
|
-
tzdata shared-mime-info
|
88
|
-
) %>
|
89
|
-
|
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
|
-
<% if distro =~ /ubuntu2004/ %>
|
100
|
-
<% packages << 'libsnmp35' %>
|
101
|
-
<% else %>
|
102
|
-
<% packages << 'libsnmp30' %>
|
103
|
-
<% end %>
|
104
|
-
|
105
|
-
<% if distro !~ /ubuntu2004/ %>
|
106
|
-
<% packages << 'python-pip' %>
|
107
|
-
<% end %>
|
108
|
-
|
109
|
-
<% if distro =~ /debian10/ %>
|
110
|
-
<% packages << 'openjdk-11-jdk-headless' %>
|
111
|
-
<% elsif distro =~ /ubuntu1404/ %>
|
112
|
-
# Ubuntu 14.04 only has openjdk 7, this is too old to be useful
|
113
|
-
<% else %>
|
114
|
-
<% packages << 'openjdk-8-jdk-headless' %>
|
115
|
-
<% end %>
|
116
|
-
|
117
|
-
# ubuntu1404, ubuntu1604: libcurl3
|
118
|
-
# ubuntu1804, ubuntu2004, debian10: libcurl4
|
119
|
-
<% if distro =~ /ubuntu1804|ubuntu2004|debian10/ %>
|
120
|
-
<% packages << 'libcurl4' %>
|
121
|
-
<% else %>
|
122
|
-
<% packages << 'libcurl3' %>
|
123
|
-
<% end %>
|
124
|
-
|
125
|
-
<% if distro =~ /ubuntu1804/ %>
|
126
|
-
<% packages << 'nodejs' %>
|
127
|
-
<% end %>
|
128
|
-
|
129
|
-
<% if distro =~ /ubuntu2004/ %>
|
130
|
-
<% packages += %w(ruby ruby2.7 bundler python2 python2-dev) %>
|
131
|
-
<% end %>
|
132
|
-
|
133
|
-
RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
|
134
|
-
<% else %>
|
135
|
-
|
136
|
-
<% if distro =~ /rhel6/ %>
|
137
|
-
|
138
|
-
# CentOS 6 is dead - to use it retrieve the packages from vault:
|
139
|
-
# https://stackoverflow.com/questions/53562691/error-cannot-retrieve-repository-metadata-repomd-xml-for-repository-base-pl
|
140
|
-
|
141
|
-
<%
|
142
|
-
|
143
|
-
cfg = <<-CFG
|
144
|
-
[base]
|
145
|
-
name=CentOS-$releasever - Base
|
146
|
-
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
|
147
|
-
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
|
148
|
-
baseurl=http://vault.centos.org/6.10/os/x86_64/
|
149
|
-
gpgcheck=1
|
150
|
-
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
151
|
-
CFG
|
152
|
-
|
153
|
-
%>
|
154
|
-
|
155
|
-
RUN printf "<%= cfg.gsub("\n", "\\n") %>" >/etc/yum.repos.d/CentOS-Base.repo
|
156
|
-
|
157
|
-
<% end %>
|
158
|
-
|
159
|
-
# Enterprise server: net-snmp
|
160
|
-
# lsb_release: redhat-lsb-core
|
161
|
-
# our runner scripts: which
|
162
|
-
# Ruby dependency: libyaml
|
163
|
-
# compiling python packages: gcc python-devel
|
164
|
-
# Kerberos tests: krb5-workstation + cyrus-sasl-devel to build the
|
165
|
-
# mongo_kerberos gem + cyrus-sasl-gssapi for authentication to work
|
166
|
-
# Local Kerberos server: krb5-server
|
167
|
-
# JRuby: java-1.8.0-openjdk
|
168
|
-
#
|
169
|
-
# Note: lacking cyrus-sasl-gssapi produces a cryptic message
|
170
|
-
# "SASL(-4): no mechanism available: No worthy mechs found"
|
171
|
-
# https://github.com/farorm/python-ad/issues/10
|
172
|
-
|
173
|
-
RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
|
174
|
-
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
|
175
|
-
net-snmp python3
|
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 %>
|
187
|
-
|
188
|
-
RUN yum install -y python-devel
|
189
|
-
|
190
|
-
<% end %>
|
191
|
-
|
192
|
-
<% end %>
|
193
|
-
|
194
|
-
<% if preload? %>
|
195
|
-
|
196
|
-
<% if distro =~ /ubuntu1404/ %>
|
197
|
-
|
198
|
-
# I couldn't find a prebuilt package of anything more recent than 2.7.6
|
199
|
-
# for 14.04.
|
200
|
-
RUN curl --retry 3 -fL https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tar.xz | \
|
201
|
-
tar xfJ - && \
|
202
|
-
cd Python-2.7.16 && \
|
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%>
|
217
|
-
|
218
|
-
<% if true || distro =~ /rhel|ubuntu1604/ %>
|
219
|
-
|
220
|
-
# Ubuntu 12.04 ships pip 1.0 which is ancient and does not work.
|
221
|
-
#
|
222
|
-
# Ubuntu 16.04 apparently also ships a pip that does not work:
|
223
|
-
# https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry
|
224
|
-
# Potentially this only affects environments with less than ideal
|
225
|
-
# connectivity (or, perhaps, when python package registry is experiencing
|
226
|
-
# availability issues) when pip must retry to install packages.
|
227
|
-
#
|
228
|
-
# rhel apparently does not package pip at all in core repoitories,
|
229
|
-
# therefore install it the manual way.
|
230
|
-
#
|
231
|
-
# https://pip.pypa.io/en/stable/installing/
|
232
|
-
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
|
233
|
-
|
234
|
-
<% end %>
|
235
|
-
|
236
|
-
# Current virtualenv fails with
|
237
|
-
# https://github.com/pypa/virtualenv/issues/1630
|
238
|
-
<% if distro =~ /ubuntu2004/ %>
|
239
|
-
RUN python3 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
|
240
|
-
<% else %>
|
241
|
-
RUN python2 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
|
242
|
-
<% end %>
|
243
|
-
|
244
|
-
RUN pip --version && \
|
245
|
-
pip install mtools-legacy[mlaunch]
|
246
|
-
|
247
|
-
<% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
|
248
|
-
# ubuntu1604 installs MarkupSafe 0.0.0 here instead of 2.0.0+
|
249
|
-
# as specified by dependencies, causing OCSP mock to not work.
|
250
|
-
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
|
251
|
-
<% end %>
|
252
|
-
|
253
|
-
# FLE is tested against 4.0+ servers.
|
254
|
-
<% if @env.fetch('MONGODB_VERSION') >= '4.0' %>
|
255
|
-
# Requirements in drivers-evergreen-tools:
|
256
|
-
# boto3~=1.19 cryptography~=3.4.8 pykmip~=0.10.0
|
257
|
-
# cryptography does not install due to lacking setuptools_rust
|
258
|
-
# (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
|
260
|
-
<% end %>
|
261
|
-
|
262
|
-
<% unless ruby_head? || system_ruby? %>
|
263
|
-
|
264
|
-
RUN curl --retry 3 -fL <%= ruby_toolchain_url(ruby) %> |tar -xC /opt -Jf -
|
265
|
-
ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
|
266
|
-
USE_OPT_TOOLCHAIN=1
|
267
|
-
#ENV PATH=/opt/rubies/python/3/bin:$PATH
|
268
|
-
|
269
|
-
<% end %>
|
270
|
-
|
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
|
-
<% end %>
|
276
|
-
|
277
|
-
<% if distro =~ /debian|ubuntu/ %>
|
278
|
-
# mkdir was moved from /usr/bin to /bin and MongoDB's distros
|
279
|
-
# apparently keep using the old location.
|
280
|
-
# This definitely affects debian10.
|
281
|
-
# https://stackoverflow.com/questions/64653051/make-usr-bin-mkdir-command-not-found-during-gem-install-nokogiri-in-ubuntu
|
282
|
-
RUN test -f /usr/bin/mkdir || ln -s /bin/mkdir /usr/bin/mkdir
|
283
|
-
<% end %>
|
284
|
-
|
285
|
-
WORKDIR /app
|
286
|
-
|
287
|
-
<% if preload? && !ruby_head? %>
|
288
|
-
|
289
|
-
COPY Gemfile .
|
290
|
-
COPY gemfiles gemfiles
|
291
|
-
COPY *.gemspec .
|
292
|
-
COPY lib/<%= project_lib_subdir %>/version.rb lib/<%= project_lib_subdir %>/version.rb
|
293
|
-
RUN bundle install
|
294
|
-
COPY .evergreen/patch-debuggers .evergreen/patch-debuggers
|
295
|
-
<% if system_ruby? %>
|
296
|
-
# Running under docker with root access
|
297
|
-
RUN .evergreen/patch-debuggers /var/lib/gems
|
298
|
-
<% else %>
|
299
|
-
RUN .evergreen/patch-debuggers /opt/rubies
|
300
|
-
<% end %>
|
301
|
-
|
302
|
-
<% end %>
|
303
|
-
|
304
|
-
<% if fle? %>
|
305
|
-
RUN curl --retry 3 -fL "https://s3.amazonaws.com/mciuploads/libmongocrypt/all/master/latest/libmongocrypt-all.tar.gz" |tar zxf -
|
306
|
-
|
307
|
-
<%= "ENV LIBMONGOCRYPT_PATH #{libmongocrypt_path}" %>
|
308
|
-
<% end %>
|
309
|
-
|
310
|
-
<% if preload? %>
|
311
|
-
ENV DOCKER_PRELOAD=1
|
312
|
-
<% end %>
|
313
|
-
|
314
|
-
ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
|
315
|
-
PROJECT_DIRECTORY=/app \
|
316
|
-
<%= @env.map { |k, v| %Q`#{k}="#{v.gsub('$', "\\$").gsub('"', "\\\"")}"` }.join(" \\\n ") %>
|
317
|
-
|
318
|
-
<% if interactive? %>
|
319
|
-
ENV INTERACTIVE=1
|
320
|
-
<% end %>
|
321
|
-
|
322
|
-
COPY . .
|
323
|
-
|
324
|
-
<% if expose? %>
|
325
|
-
|
326
|
-
<% ports = [] %>
|
327
|
-
|
328
|
-
<% 0.upto(num_exposed_ports-1) do |i| %>
|
329
|
-
<% ports << 27017 + i %>
|
330
|
-
<% end %>
|
331
|
-
|
332
|
-
<% if @env['OCSP_ALGORITHM'] %>
|
333
|
-
<% ports << 8100 %>
|
334
|
-
<% end %>
|
335
|
-
|
336
|
-
EXPOSE <%= ports.map(&:to_s).join(' ') %>
|
337
|
-
|
338
|
-
<% end %>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Modeled after
|
2
|
-
# https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-load-balancer.sh
|
3
|
-
|
4
|
-
defaults
|
5
|
-
mode tcp
|
6
|
-
timeout connect 7s
|
7
|
-
timeout client 55s
|
8
|
-
timeout server 55s
|
9
|
-
|
10
|
-
frontend mongos_frontend
|
11
|
-
bind *:27017
|
12
|
-
use_backend mongos_backend
|
13
|
-
|
14
|
-
backend mongos_backend
|
15
|
-
mode tcp
|
16
|
-
server mongos_one 127.0.0.1:27117 check
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Modeled after
|
2
|
-
# https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-load-balancer.sh
|
3
|
-
|
4
|
-
defaults
|
5
|
-
mode tcp
|
6
|
-
timeout connect 7s
|
7
|
-
timeout client 55s
|
8
|
-
timeout server 55s
|
9
|
-
|
10
|
-
frontend mongos_frontend
|
11
|
-
bind *:27017
|
12
|
-
use_backend mongos_backend
|
13
|
-
|
14
|
-
backend mongos_backend
|
15
|
-
mode tcp
|
16
|
-
server mongos_one 127.0.0.1:27117 check
|
17
|
-
server mongos_two 127.0.0.1:27118 check
|