summaryrefslogtreecommitdiff
path: root/buildscripts/resmokelib/setup_multiversion/config.py
blob: f2c63921ef330c404dabf38ae62421deb1f2a8cb (plain)
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
"""Setup multiversion config."""
from typing import List

SETUP_MULTIVERSION_CONFIG = "buildscripts/resmokeconfig/setup_multiversion/setup_multiversion_config.yml"


class Buildvariant:
    """Class represents buildvariant in setup multiversion config."""

    name: str
    edition: str
    platform: str
    architecture: str
    versions: List[str]

    def __init__(self, buildvariant_yaml: dict):
        """Initialize."""
        self.name = buildvariant_yaml.get("name", "")
        self.edition = buildvariant_yaml.get("edition", "")
        self.platform = buildvariant_yaml.get("platform", "")
        self.architecture = buildvariant_yaml.get("architecture", "")
        self.versions = buildvariant_yaml.get("versions", [])


class SetupMultiversionConfig:
    """Class represents setup multiversion config."""

    evergreen_projects: List[str]
    evergreen_buildvariants: List[Buildvariant]

    def __init__(self, raw_yaml: dict):
        """Initialize."""
        self.evergreen_projects = raw_yaml.get("evergreen_projects", [])
        self.evergreen_buildvariants = []
        buildvariants_raw_yaml = raw_yaml.get("evergreen_buildvariants", "")
        for buildvariant_yaml in buildvariants_raw_yaml:
            self.evergreen_buildvariants.append(Buildvariant(buildvariant_yaml))