def main():
    library.register_log_handlers()
    library.convert_sigterm_to_exception()

    parser = argparse.ArgumentParser(
        description=
        'Run irods_consortium_continuous_integration_build_hook.py on icat')
    parser.add_argument('--deployment_name', type=str, required=True)
    parser.add_argument('--zone_bundle_input', type=str, required=True)
    parser.add_argument('--version_to_packages_map',
                        type=str,
                        nargs='+',
                        required=True)
    parser.add_argument(
        '--install_dev_package',
        type=library.make_argparse_true_or_false('--install_dev_package'),
        required=True)
    parser.add_argument('--git_repository', type=str, required=True)
    parser.add_argument('--git_commitish', type=str, required=True)
    parser.add_argument('--python_script', type=str, required=True)
    parser.add_argument('--leak_vms',
                        type=library.make_argparse_true_or_false('--leak_vms'),
                        required=True)
    parser.add_argument('--passthrough_arguments',
                        default=[],
                        nargs=argparse.REMAINDER)
    args = parser.parse_args()

    version_to_packages_map = list_to_dict(args.version_to_packages_map)
    passthru_args_dict = list_to_dict(args.passthrough_arguments)

    mungefs_packages_dir = 'None'
    if '--mungefs_packages_dir' in passthru_args_dict:
        mungefs_packages_dir = passthru_args_dict['--mungefs_packages_dir']

    with open(args.zone_bundle_input) as f:
        zone_bundle = json.load(f)

    deployed_zone_bundle = deploy.deploy(
        zone_bundle,
        args.deployment_name,
        version_to_packages_map,
        mungefs_packages_dir,
        install_dev_package=args.install_dev_package)
    with destroy.deployed_zone_bundle_manager(
            deployed_zone_bundle,
            on_exception=not args.leak_vms,
            on_regular_exit=not args.leak_vms):
        ansible_result = checkout_git_repo_and_run_python_script_on_icat(
            deployed_zone_bundle, args.git_repository, args.git_commitish,
            args.python_script, args.passthrough_arguments)

    if library.ansible_run_failed(ansible_result):
        sys.exit(1)
def main():
    library.register_log_handlers()
    library.convert_sigterm_to_exception()

    parser = argparse.ArgumentParser(
        description='Run tests on resource server')
    parser.add_argument('--deployment_name', type=str, required=True)
    parser.add_argument('--zone_bundle_input', type=str, required=True)
    parser.add_argument('--version_to_packages_map',
                        type=str,
                        nargs='+',
                        required=True)
    parser.add_argument(
        '--install_dev_package',
        type=library.make_argparse_true_or_false('--install_dev_package'),
        required=True)
    parser.add_argument('--leak_vms',
                        type=library.make_argparse_true_or_false('--leak_vms'),
                        required=True)
    parser.add_argument('--test_type',
                        type=str,
                        required=True,
                        choices=[
                            'standalone_icat', 'topology_icat',
                            'topology_resource', 'federation'
                        ])
    parser.add_argument('--irods_plugin_packages_directory',
                        type=str,
                        required=True)
    parser.add_argument('--mungefs_packages_dir', type=str)
    parser.add_argument('--output_directory', type=str, required=True)

    args = parser.parse_args()

    version_to_packages_map = list_to_dict(args.version_to_packages_map)

    with open(args.zone_bundle_input) as f:
        zone_bundle = json.load(f)

    deployed_zone_bundle = deploy.deploy(
        zone_bundle,
        args.deployment_name,
        version_to_packages_map,
        args.mungefs_packages_dir,
        install_dev_package=args.install_dev_package)

    with destroy.deployed_zone_bundle_manager(
            deployed_zone_bundle,
            on_exception=not args.leak_vms,
            on_regular_exit=not args.leak_vms):
        install_plugin_and_run_tests(deployed_zone_bundle,
                                     args.irods_plugin_packages_directory,
                                     args.test_type, args.output_directory)
def main():
    library.register_log_handlers()
    library.convert_sigterm_to_exception()

    parser = argparse.ArgumentParser(description='Run topology upgrade tests on resource server')
    parser.add_argument('--deployment_name', type=str, required=True)
    parser.add_argument('--zone_bundle_input', type=str, required=True)
    parser.add_argument('--version_to_packages_map', type=str, nargs='+', required=True)
    parser.add_argument('--mungefs_packages_root_dir', type=str, required=False, default=None)
    parser.add_argument('--leak_vms', type=library.make_argparse_true_or_false('--leak_vms'), required=True)
    parser.add_argument('--use_ssl', action='store_true')
    parser.add_argument('--upgrade_packages_root_directory', type=str, required=True)
    parser.add_argument('--test_type', type=str, required=True, choices=['standalone_icat', 'topology_icat', 'topology_resource', 'federation'])
    parser.add_argument('--output_directory', type=str, required=True)
    args = parser.parse_args()


    version_to_packages_map = list_to_dict(args.version_to_packages_map)

    if not args.output_directory:
        args.zone_bundle_output
    with open(args.zone_bundle_input) as f:
        zone_bundle = json.load(f)

    zone_bundle_name = args.deployment_name + '.json'
    zone_bundle_output = os.path.join(args.output_directory, zone_bundle_name)
    deployed_zone_bundle = deploy.deploy(zone_bundle, args.deployment_name, version_to_packages_map, args.mungefs_packages_root_dir, zone_bundle_output)
    with destroy.deployed_zone_bundle_manager(deployed_zone_bundle, on_exception=not args.leak_vms, on_regular_exit=not args.leak_vms):
         upgrade.upgrade(deployed_zone_bundle, args.upgrade_packages_root_directory)
         
         if args.use_ssl:
             enable_ssl.enable_ssl(deployed_zone_bundle)

         tests_passed = test.test(deployed_zone_bundle, args.test_type, args.use_ssl, False, args.output_directory)
         gather.gather(deployed_zone_bundle, args.output_directory)

    if not tests_passed:
        sys.exit(1)
        'federation': zone['icat_server']['server_config']['federation'],
        'disable_client_server_negotiation': disable_client_server_negotiation,
    }
    library.run_ansible(module_name='irods_configuration_federation', complex_args=complex_args, host_list=host_list, sudo=True)

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Interact with zone-bundles.json')
    parser.add_argument('--zone_bundle_input', type=str, required=True)
    parser.add_argument('--deployment_name', type=str, required=True)
    parser.add_argument('--version_to_packages_map', type=str, required=True, nargs='+')
    parser.add_argument('--mungefs_packages_dir', type=str, required=False)
    parser.add_argument('--install_dev_package', action='store_true')
    parser.add_argument('--zone_bundle_output', type=str)
    parser.add_argument('--leave-vm-on-failure', action='store_true')
    args = parser.parse_args()

    version_to_packages_map = {}
    for i in range(0, len(args.version_to_packages_map), 2):
        version_to_packages_map[args.version_to_packages_map[i]] = args.version_to_packages_map[i+1]

    if not args.zone_bundle_output:
        args.zone_bundle_output = os.path.abspath(args.deployment_name + '.json')

    with open(args.zone_bundle_input) as f:
        zone_bundle = json.load(f)

    library.register_log_handlers()
    library.convert_sigterm_to_exception()

    deploy(zone_bundle, args.deployment_name, version_to_packages_map, args.mungefs_packages_dir, args.zone_bundle_output, not args.leave_vm_on_failure, install_dev_package=args.install_dev_package)
Beispiel #5
0
import enable_ssl
import gather
import library
import test
import upgrade


def list_to_dict(l):
    d = {}
    for i in range(0, len(l), 2):
        d[l[i]] = l[i + 1]
    return d


if __name__ == '__main__':
    library.register_log_handlers()
    library.convert_sigterm_to_exception()

    parser = argparse.ArgumentParser(
        description='Run iRODS tests from Jenkins')
    parser.add_argument('--zone_bundle_input', type=str, required=True)
    parser.add_argument('--deployment_name', type=str, required=True)
    parser.add_argument('--version_to_packages_map',
                        type=str,
                        required=True,
                        nargs='+')
    parser.add_argument('--mungefs_packages_root_dir',
                        type=str,
                        required=False,
                        default=None)
    parser.add_argument('--test_type',
def main():
    library.register_log_handlers()
    library.convert_sigterm_to_exception()

    parser = argparse.ArgumentParser(
        description='Run topology upgrade tests on resource server')
    parser.add_argument('--deployment_name', type=str, required=True)
    parser.add_argument('--zone_bundle_input', type=str, required=True)
    parser.add_argument('--version_to_packages_map',
                        type=str,
                        nargs='+',
                        required=True)
    parser.add_argument('--mungefs_packages_root_dir',
                        type=str,
                        required=False,
                        default=None)
    parser.add_argument('--leak_vms',
                        type=library.make_argparse_true_or_false('--leak_vms'),
                        required=True)
    parser.add_argument('--use_ssl', action='store_true')
    parser.add_argument('--upgrade_packages_root_directory',
                        type=str,
                        required=True)
    parser.add_argument('--test_type',
                        type=str,
                        required=True,
                        choices=[
                            'standalone_icat', 'topology_icat',
                            'topology_resource', 'federation'
                        ])
    parser.add_argument('--output_directory', type=str, required=True)
    args = parser.parse_args()

    version_to_packages_map = list_to_dict(args.version_to_packages_map)

    if not args.output_directory:
        args.zone_bundle_output
    with open(args.zone_bundle_input) as f:
        zone_bundle = json.load(f)

    zone_bundle_name = args.deployment_name + '.json'
    zone_bundle_output = os.path.join(args.output_directory, zone_bundle_name)
    deployed_zone_bundle = deploy.deploy(zone_bundle, args.deployment_name,
                                         version_to_packages_map,
                                         args.mungefs_packages_root_dir,
                                         zone_bundle_output)
    with destroy.deployed_zone_bundle_manager(
            deployed_zone_bundle,
            on_exception=not args.leak_vms,
            on_regular_exit=not args.leak_vms):
        upgrade.upgrade(deployed_zone_bundle,
                        args.upgrade_packages_root_directory)

        if args.use_ssl:
            enable_ssl.enable_ssl(deployed_zone_bundle)

        tests_passed = test.test(deployed_zone_bundle, args.test_type,
                                 args.use_ssl, False, args.output_directory)
        gather.gather(deployed_zone_bundle, args.output_directory)

    if not tests_passed:
        sys.exit(1)