Skip to content

Commit 15828e0

Browse files
authored
CDRIVER-3935 lower evg batchtimes and add evg config generator (#774)
1 parent c883dab commit 15828e0

File tree

6 files changed

+422
-14
lines changed

6 files changed

+422
-14
lines changed

.evergreen/config.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
# DO NOT EDIT THIS FILE
88
#
99
####################################
10-
1110
stepback: true
1211
command_type: system
1312
exec_timeout_secs: 2400
@@ -264,9 +263,9 @@ functions:
264263
remote_file: ${project}/${build_variant}/${revision}/${version_id}/${build_id}/abi-compliance/compat_report.html
265264
bucket: mciuploads
266265
permissions: public-read
267-
display_name: 'ABI Report:'
268-
content_type: text/html
269266
local_files_include_filter: mongoc/abi-compliance/compat_reports/**/*.html
267+
content_type: text/html
268+
display_name: 'ABI Report:'
270269
upload scan artifacts:
271270
- command: shell.exec
272271
type: test
@@ -2038,9 +2037,9 @@ tasks:
20382037
commands:
20392038
- command: s3.get
20402039
params:
2041-
aws_key: '${toolchain_aws_key}'
2042-
aws_secret: '${toolchain_aws_secret}'
2043-
remote_file: 'mongo-c-toolchain/${distro_id}/mongo-c-toolchain.tar.gz'
2040+
aws_key: ${toolchain_aws_key}
2041+
aws_secret: ${toolchain_aws_secret}
2042+
remote_file: mongo-c-toolchain/${distro_id}/mongo-c-toolchain.tar.gz
20442043
bucket: mongo-c-toolchain
20452044
local_file: mongo-c-toolchain.tar.gz
20462045
- command: shell.exec
@@ -23043,7 +23042,7 @@ buildvariants:
2304323042
- .debug-compile !.sspi .nossl !.sasl
2304423043
- .debug-compile .special .valgrind
2304523044
- .test-valgrind !.3.0 !.3.2 !.3.4 !.3.6
23046-
batchtime: 10080
23045+
batchtime: 1440
2304723046
- name: valgrind-ubuntu-1404
2304823047
display_name: Valgrind Tests - MongoDB (pre 4.0) (Ubuntu 14.04)
2304923048
expansions:
@@ -23057,7 +23056,7 @@ buildvariants:
2305723056
- .test-valgrind .3.2
2305823057
- .test-valgrind .3.4
2305923058
- .test-valgrind .3.6
23060-
batchtime: 10080
23059+
batchtime: 1440
2306123060
- name: asan-ubuntu
2306223061
display_name: ASAN Tests (Ubuntu 16.04)
2306323062
expansions:
@@ -23145,7 +23144,7 @@ buildvariants:
2314523144
- name: .ocsp-openssl-1.0.1
2314623145
distros:
2314723146
- ubuntu1804-test
23148-
batchtime: 20160
23147+
batchtime: 10080
2314923148
- name: packaging
2315023149
display_name: Linux Distro Packaging
2315123150
run_on: ubuntu1604-test
@@ -23162,4 +23161,4 @@ buildvariants:
2316223161
run_on: ubuntu1604-small
2316323162
tasks:
2316423163
- .tsan
23165-
batchtime: 10080
23164+
batchtime: 1440
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Copyright 2018-present MongoDB, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
import sys
17+
from collections import OrderedDict as OD
18+
19+
try:
20+
import yaml
21+
import yamlordereddictloader
22+
except ImportError:
23+
sys.stderr.write(
24+
"try 'pip install -r evergreen_config_generator/requirements.txt'\n")
25+
raise
26+
27+
28+
class ConfigObject(object):
29+
def __init__(self, *args, **kwargs):
30+
super(ConfigObject, self).__init__()
31+
32+
@property
33+
def name(self):
34+
return 'UNSET'
35+
36+
def to_dict(self):
37+
return OD([('name', self.name)])
38+
39+
40+
# We want legible YAML tasks:
41+
#
42+
# - name: debug-compile
43+
# tags: [zlib, snappy, compression, openssl]
44+
# commands:
45+
# - command: shell.exec
46+
# params:
47+
# script: |-
48+
# set -o errexit
49+
# set -o xtrace
50+
# ...
51+
#
52+
# Write values compactly except multiline strings, which use "|" style. Write
53+
# tag sets as lists.
54+
55+
class _Dumper(yamlordereddictloader.Dumper):
56+
def __init__(self, *args, **kwargs):
57+
super(_Dumper, self).__init__(*args, **kwargs)
58+
self.add_representer(set, type(self).represent_set)
59+
# Use "multi_representer" to represent all subclasses of ConfigObject.
60+
self.add_multi_representer(ConfigObject,
61+
type(self).represent_config_object)
62+
63+
def represent_scalar(self, tag, value, style=None):
64+
if isinstance(value, (str)) and '\n' in value:
65+
style = '|'
66+
return super(_Dumper, self).represent_scalar(tag, value, style)
67+
68+
def represent_set(self, data):
69+
return super(_Dumper, self).represent_list(sorted(data))
70+
71+
def represent_config_object(self, obj):
72+
return super(_Dumper, self).represent_data(obj.to_dict())
73+
74+
75+
def yaml_dump(obj):
76+
return yaml.dump(obj, Dumper=_Dumper)
77+
78+
79+
def generate(config, path):
80+
"""Dump config to a file as YAML.
81+
config is a dict, preferably an OrderedDict. path is a file path.
82+
"""
83+
f = open(path, 'w+')
84+
f.write('''####################################
85+
# Evergreen configuration
86+
#
87+
# Generated with evergreen_config_generator from
88+
# github.com/mongodb-labs/drivers-evergreen-tools
89+
#
90+
# DO NOT EDIT THIS FILE
91+
#
92+
####################################
93+
''')
94+
f.write(yaml_dump(config))
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Copyright 2018-present MongoDB, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from collections import OrderedDict as OD
16+
from textwrap import dedent
17+
18+
from evergreen_config_generator import ConfigObject
19+
20+
21+
def func(func_name, **kwargs):
22+
od = OD([('func', func_name)])
23+
if kwargs:
24+
od['vars'] = OD(sorted(kwargs.items()))
25+
26+
return od
27+
28+
29+
def bootstrap(VERSION='latest', TOPOLOGY=None, **kwargs):
30+
if TOPOLOGY:
31+
return func('bootstrap mongo-orchestration',
32+
VERSION=VERSION,
33+
TOPOLOGY=TOPOLOGY,
34+
**kwargs)
35+
36+
return func('bootstrap mongo-orchestration',
37+
VERSION=VERSION,
38+
**kwargs)
39+
40+
41+
def run_tests(URI=None, **kwargs):
42+
if URI:
43+
return func('run tests', URI=URI, **kwargs)
44+
45+
return func('run tests', **kwargs)
46+
47+
48+
def s3_put(remote_file, project_path=True, **kwargs):
49+
if project_path:
50+
remote_file = '${project}/' + remote_file
51+
52+
od = OD([
53+
('command', 's3.put'),
54+
('params', OD([
55+
('aws_key', '${aws_key}'),
56+
('aws_secret', '${aws_secret}'),
57+
('remote_file', remote_file),
58+
('bucket', 'mciuploads'),
59+
('permissions', 'public-read')]))])
60+
61+
od['params'].update(kwargs)
62+
return od
63+
64+
65+
def strip_lines(s):
66+
return '\n'.join(line for line in s.split('\n') if line.strip())
67+
68+
69+
def shell_exec(script, test=True, errexit=True, xtrace=True, silent=False,
70+
continue_on_err=False, working_dir=None, background=False):
71+
dedented = ''
72+
if errexit:
73+
dedented += 'set -o errexit\n'
74+
75+
if xtrace:
76+
dedented += 'set -o xtrace\n'
77+
78+
dedented += dedent(strip_lines(script))
79+
command = OD([('command', 'shell.exec')])
80+
if test:
81+
command['type'] = 'test'
82+
83+
command['params'] = OD()
84+
if silent:
85+
command['params']['silent'] = True
86+
87+
if working_dir is not None:
88+
command['params']['working_dir'] = working_dir
89+
90+
if continue_on_err:
91+
command['params']['continue_on_err'] = True
92+
93+
if background:
94+
command['params']['background'] = True
95+
96+
command['params']['shell'] = 'bash'
97+
command['params']['script'] = dedented
98+
return command
99+
100+
101+
def targz_pack(target, source_dir, *include):
102+
return OD([
103+
('command', 'archive.targz_pack'),
104+
('params', OD([
105+
('target', target),
106+
('source_dir', source_dir),
107+
('include', list(include))]))])
108+
109+
110+
class Function(ConfigObject):
111+
def __init__(self, *commands):
112+
super(Function, self).__init__()
113+
self.commands = commands
114+
115+
def to_dict(self):
116+
return list(self.commands)

0 commit comments

Comments
 (0)