예제 #1
0
def main(raw_args):
    args = _parse_arguments(raw_args)

    with tempfile.TemporaryDirectory(prefix="cmk-run-dockerized-") as tmpdir:
        tmp_path = Path(tmpdir)

        distro_name = os.environ.get("DISTRO", "ubuntu-19.04")
        docker_tag = os.environ.get("DOCKER_TAG", "%s-latest" % current_base_branch_name())
        version_spec = os.environ.get("VERSION", CMKVersion.GIT)
        edition = os.environ.get("EDITION", CMKVersion.CEE)
        branch = os.environ.get("BRANCH", current_base_branch_name())

        version = CMKVersion(version_spec, edition, branch)
        logger.info("Version: %s (%s), Edition: %s, Branch: %s", version.version,
                    version.version_spec, edition, branch)

        result_path = Path(os.environ.get("RESULT_PATH", tmp_path.joinpath("results")))
        result_path.mkdir(parents=True, exist_ok=True)
        logger.info("Prepared result path: %s", result_path)

        return execute_tests_in_container(
            distro_name=distro_name,
            docker_tag=docker_tag,
            command=["make", "-C", "tests-py3", args.make_target],
            version=version,
            result_path=result_path,
            interactive=args.make_target == "debug",
        )
예제 #2
0
def main(raw_args):
    args = _parse_arguments(raw_args)

    distro_name = _os_environ_get("DISTRO", "ubuntu-20.04")
    docker_tag = _os_environ_get("DOCKER_TAG",
                                 "%s-latest" % current_base_branch_name())
    version_spec = _os_environ_get("VERSION", CMKVersion.GIT)
    edition = _os_environ_get("EDITION", CMKVersion.CEE)
    branch = _os_environ_get("BRANCH", current_base_branch_name())

    version = CMKVersion(version_spec, edition, branch)
    logger.info("Version: %s (%s), Edition: %s, Branch: %s", version.version,
                version.version_spec, edition, branch)

    result_path_str = _os_environ_get("RESULT_PATH", "")
    if result_path_str:
        result_path = Path(result_path_str)
    else:
        # Only create the temporary directory when RESULT_PATH not given. And keep it after the
        # script finishes. Otherwise the results are lost.
        result_path = Path(tempfile.mkdtemp(prefix="cmk-run-dockerized-"))

    result_path.mkdir(parents=True, exist_ok=True)
    logger.info("Prepared result path: %s", result_path)

    return execute_tests_in_container(
        distro_name=distro_name,
        docker_tag=docker_tag,
        command=["make", "-C", "tests", args.make_target],
        version=version,
        result_path=result_path,
        interactive=args.make_target == "debug",
    )
예제 #3
0
파일: site.py 프로젝트: sri-sysad/checkmk
def get_site_factory(prefix, update_from_git, install_test_python_modules):
    version = os.environ.get("VERSION", CMKVersion.DAILY)
    edition = os.environ.get("EDITION", CMKVersion.CEE)
    branch = os.environ.get("BRANCH")
    if branch is None:
        branch = current_base_branch_name()

    logger.info("Version: %s, Edition: %s, Branch: %s", version, edition, branch)
    return SiteFactory(
        version=version,
        edition=edition,
        branch=branch,
        prefix=prefix,
        update_from_git=update_from_git,
        install_test_python_modules=install_test_python_modules,
    )
예제 #4
0
def main():
    add_python_paths()

    version_spec = os.environ.get("VERSION", CMKVersion.DAILY)
    edition = os.environ.get("EDITION", CMKVersion.CEE)
    branch = os.environ.get("BRANCH")
    if branch is None:
        branch = current_base_branch_name()

    logger.info("Version: %s, Edition: %s, Branch: %s", version_spec, edition, branch)
    version = CMKVersion(version_spec, edition, branch)

    if version.is_installed():
        logger.info("Version %s is already installed. Terminating.")
        return 0

    manager = ABCPackageManager.factory()
    manager.install(version.version, version.edition())

    if not version.is_installed():
        logger.error("Failed not install version")

    return 0