import os import shutil import sys import ci_lib # DebOps only supports Debian. ci_lib.DISTROS = ['debian'] * ci_lib.TARGET_COUNT project_dir = os.path.join(ci_lib.TMP, 'project') vars_path = 'ansible/inventory/group_vars/debops_all_hosts.yml' inventory_path = 'ansible/inventory/hosts' docker_hostname = ci_lib.get_docker_hostname() with ci_lib.Fold('docker_setup'): containers = ci_lib.make_containers(port_offset=500, name_prefix='debops-') ci_lib.start_containers(containers) with ci_lib.Fold('job_setup'): ci_lib.run('debops-init %s', project_dir) os.chdir(project_dir) ansible_strategy_plugin = "{}/ansible_mitogen/plugins/strategy".format( ci_lib.GIT_ROOT) with open('.debops.cfg', 'w') as fp: fp.write("[ansible defaults]\n" "strategy_plugins = {}\n" "strategy = mitogen_linear\n".format(ansible_strategy_plugin)) with open(vars_path, 'w') as fp:
signal.pause() interesting = ci_lib.get_interesting_procs() with ci_lib.Fold('unit_tests'): os.environ['SKIP_MITOGEN'] = '1' ci_lib.run('./run_tests -v') ci_lib.check_stray_processes(interesting) with ci_lib.Fold('docker_setup'): containers = ci_lib.make_containers() ci_lib.start_containers(containers) with ci_lib.Fold('job_setup'): os.chdir(TESTS_DIR) os.chmod('../data/docker/mitogen__has_sudo_pubkey.key', int('0600', 7)) run("mkdir %s", HOSTS_DIR) for path in glob.glob(TESTS_DIR + '/hosts/*'): if not path.endswith('default.hosts'): run("ln -s %s %s", path, HOSTS_DIR) inventory_path = os.path.join(HOSTS_DIR, 'target') with open(inventory_path, 'w') as fp: fp.write('[test-targets]\n')