File: generate-evergreen-config.py

package info (click to toggle)
mongo-c-driver 1.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 31,116 kB
  • sloc: ansic: 124,705; python: 2,971; sh: 138; makefile: 23
file content (70 lines) | stat: -rw-r--r-- 2,332 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
#
# Copyright 2018-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Generate C Driver's config.yml for Evergreen testing.

We find that generating configuration from Python data structures is more
legible than Evergreen's matrix syntax or a handwritten file.

Written for Python 2.6+. Requires the evergreen_config_generator package.
"""

from collections import OrderedDict as OD
from os.path import dirname, join as joinpath, normpath
import sys

try:
    from evergreen_config_generator import generate
except ImportError:
    sys.stderr.write("""\
Could not find evergreen_config_generator package, try:

python -m pip install -e git+https://github.com/mongodb-labs/\
drivers-evergreen-tools#subdirectory=evergreen_config_generator\
&egg=evergreen_config_generator
""")
    raise

from evergreen_config_lib.functions import all_functions
from evergreen_config_lib.tasks import all_tasks
from evergreen_config_lib.variants import all_variants

config = OD([
    ('stepback', True),
    ('command_type', 'system'),
    # 40 minute max except valgrind tasks, which get 2 hours.
    ('exec_timeout_secs', 2400),
    ('functions', all_functions),
    ('pre', [
        OD([('func', 'fetch source')]),
        OD([('func', 'windows fix')]),
        OD([('func', 'make files executable')]),
        OD([('func', 'prepare kerberos')]),
    ]),
    ('post', [
        OD([('func', 'backtrace')]),
        OD([('func', 'upload working dir')]),
        OD([('func', 'upload mo artifacts')]),
        OD([('func', 'upload test results')]),
        OD([('func', 'cleanup')]),
    ]),
    ('tasks', all_tasks),
    ('buildvariants', all_variants),
])

this_dir = dirname(__file__)
evergreen_dir = normpath(joinpath(this_dir, '../.evergreen'))
generate(config, joinpath(evergreen_dir, 'config.yml'))