Skip to content
Snippets Groups Projects
check_system_workers.py 803 B
import sys
from pathlib import Path

import yaml

ROOT = Path(__file__).parent.parent


def check_versions_match():
    system_workers_file = ROOT / "arkindex" / "system_workers.yml"
    assert system_workers_file.exists(), f"Missing system workers file in {system_workers_file}"

    version_file = ROOT / "VERSION"
    assert version_file.exists(), f"Missing version file in {version_file}"

    version = version_file.read_text().strip()

    system_workers = yaml.safe_load(system_workers_file.open())

    assert system_workers["version"] == version, f"Version mismatch between VERSION ({version}) and system worker ({system_workers['version']})"


if __name__ == "__main__":
    try:
        check_versions_match()
    except AssertionError as e:
        print(f"[ERROR] {e}")
        sys.exit(1)