Beispiel #1
0
 def check_deploy_group(self) -> Tuple[bool, str]:
     deploy_group = self.get_deploy_group()
     if deploy_group is not None:
         pipeline_steps = [step['step'] for step in get_pipeline_config(self.service, self.soa_dir)]
         pipeline_deploy_groups = [step for step in pipeline_steps if is_deploy_step(step)]
         if deploy_group not in pipeline_deploy_groups:
             return False, f'deploy_group {deploy_group} is not in service {self.service} deploy.yaml'
     return True, ''
Beispiel #2
0
def deploy_has_performance_check(service, soa_dir):
    pipeline = get_pipeline_config(service=service, soa_dir=soa_dir)
    steps = [step['step'] for step in pipeline]
    if 'performance-check' in steps:
        paasta_print(PaastaCheckMessages.DEPLOY_PERFORMANCE_FOUND)
        return True
    else:
        paasta_print(PaastaCheckMessages.DEPLOY_PERFORMANCE_MISSING)
        return False
Beispiel #3
0
def deploy_has_security_check(service, soa_dir):
    pipeline = get_pipeline_config(service=service, soa_dir=soa_dir)
    steps = [step["step"] for step in pipeline]
    if "security-check" in steps:
        print(PaastaCheckMessages.DEPLOY_SECURITY_FOUND)
        return True
    else:
        print(PaastaCheckMessages.DEPLOY_SECURITY_MISSING)
        return False
Beispiel #4
0
def deployments_check(service, soa_dir):
    """Checks for consistency between deploy.yaml and the marathon/chronos yamls"""
    the_return = True
    pipeline_steps = [
        step['step'] for step in get_pipeline_config(service, soa_dir)
    ]
    pipeline_deploy_groups = [
        step for step in pipeline_steps if is_deploy_step(step)
    ]

    framework_deploy_groups = {}
    in_deploy_not_frameworks = set(pipeline_deploy_groups)
    for it in INSTANCE_TYPES:
        framework_deploy_groups[it] = get_deploy_groups_used_by_framework(
            it, service, soa_dir)
        in_framework_not_deploy = set(
            framework_deploy_groups[it]) - set(pipeline_deploy_groups)
        in_deploy_not_frameworks -= set(framework_deploy_groups[it])
        if len(in_framework_not_deploy) > 0:
            paasta_print(
                "{} There are some instance(s) you have asked to run in {} that"
                .format(x_mark(), it))
            paasta_print("  do not have a corresponding entry in deploy.yaml:")
            paasta_print("  %s" %
                         PaastaColors.bold(", ".join(in_framework_not_deploy)))
            paasta_print(
                "  You should probably configure these to use a 'deploy_group' or"
            )
            paasta_print(
                "  add entries to deploy.yaml for them so they are deployed to those clusters."
            )
            the_return = False

    if len(in_deploy_not_frameworks) > 0:
        paasta_print(
            "%s There are some instance(s) in deploy.yaml that are not referenced"
            % x_mark())
        paasta_print("  by any marathon, chronos or adhoc instance:")
        paasta_print("  %s" % PaastaColors.bold(
            (", ".join(in_deploy_not_frameworks))))
        paasta_print(
            "  You should probably delete these deploy.yaml entries if they are unused."
        )
        the_return = False

    if the_return is True:
        paasta_print(
            success(
                "All entries in deploy.yaml correspond to a marathon, chronos or adhoc entry"
            ))
        for it in INSTANCE_TYPES:
            if len(framework_deploy_groups[it]) > 0:
                paasta_print(
                    success(
                        "All %s instances have a corresponding deploy.yaml entry"
                        % it))
    return the_return