コード例 #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, ''
コード例 #2
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(
                "%s There are some instance(s) you have asked to run in %s that"
                % (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
コード例 #3
0
ファイル: check.py プロジェクト: zofuthan/paasta
def deployments_check(service, soa_dir):
    """Checks for consistency between deploy.yaml and the marathon/chronos yamls"""
    the_return = True
    pipeline_deployments = get_pipeline_config(service, soa_dir)
    pipeline_steps = [step['step'] for step in pipeline_deployments]
    pipeline_steps = [step for step in pipeline_steps if is_deploy_step(step)]
    marathon_steps = get_marathon_steps(service, soa_dir)
    chronos_steps = get_chronos_steps(service, soa_dir)
    in_marathon_not_deploy = set(marathon_steps) - set(pipeline_steps)
    in_chronos_not_deploy = set(chronos_steps) - set(pipeline_steps)
    if len(in_marathon_not_deploy) > 0:
        print "%s There are some instance(s) you have asked to run in marathon that" % x_mark(
        )
        print "  do not have a corresponding entry in deploy.yaml:"
        print "  %s" % PaastaColors.bold(", ".join(in_marathon_not_deploy))
        print "  You should probably configure these to use a 'deploy_group' or"
        print "  add entries to deploy.yaml for them so they are deployed to those clusters."
        the_return = False
    if len(in_chronos_not_deploy) > 0:
        print "%s There are some instance(s) you have asked to run in chronos that" % x_mark(
        )
        print "  do not have a corresponding entry in deploy.yaml:"
        print "  %s" % PaastaColors.bold(", ".join(in_chronos_not_deploy))
        print "  You should probably configure these to use a 'deploy_group' or"
        print "  add entries to deploy.yaml for them so they are deployed to those clusters."
        the_return = False
    in_deploy_not_marathon_chronos = set(pipeline_steps) - set(
        marathon_steps) - set(chronos_steps)
    if len(in_deploy_not_marathon_chronos) > 0:
        print "%s There are some instance(s) in deploy.yaml that are not referenced" % x_mark(
        )
        print "  by any marathon or chronos instance:"
        print "  %s" % PaastaColors.bold(
            (", ".join(in_deploy_not_marathon_chronos)))
        print "  You should probably delete these deploy.yaml entries if they are unused."
        the_return = False
    if the_return is True:
        print success(
            "All entries in deploy.yaml correspond to a marathon or chronos entry"
        )
        if len(marathon_steps) > 0:
            print success(
                "All marathon instances have a corresponding deploy.yaml entry"
            )
        if len(chronos_steps) > 0:
            print success(
                "All chronos instances have a corresponding deploy.yaml entry")
    return the_return
コード例 #4
0
ファイル: check.py プロジェクト: somic/paasta
def deployments_check(service, soa_dir):
    """Checks for consistency between deploy.yaml and the marathon/chronos yamls"""
    the_return = True
    pipeline_deployments = get_pipeline_config(service, soa_dir)
    pipeline_steps = [step["step"] for step in pipeline_deployments]
    pipeline_steps = [step for step in pipeline_steps if is_deploy_step(step)]
    marathon_steps = get_marathon_steps(service, soa_dir)
    chronos_steps = get_chronos_steps(service, soa_dir)
    in_marathon_not_deploy = set(marathon_steps) - set(pipeline_steps)
    in_chronos_not_deploy = set(chronos_steps) - set(pipeline_steps)
    if len(in_marathon_not_deploy) > 0:
        paasta_print("%s There are some instance(s) you have asked to run in marathon that" % x_mark())
        paasta_print("  do not have a corresponding entry in deploy.yaml:")
        paasta_print("  %s" % PaastaColors.bold(", ".join(in_marathon_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_chronos_not_deploy) > 0:
        paasta_print("%s There are some instance(s) you have asked to run in chronos that" % x_mark())
        paasta_print("  do not have a corresponding entry in deploy.yaml:")
        paasta_print("  %s" % PaastaColors.bold(", ".join(in_chronos_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
    in_deploy_not_marathon_chronos = set(pipeline_steps) - set(marathon_steps) - set(chronos_steps)
    if len(in_deploy_not_marathon_chronos) > 0:
        paasta_print("%s There are some instance(s) in deploy.yaml that are not referenced" % x_mark())
        paasta_print("  by any marathon or chronos instance:")
        paasta_print("  %s" % PaastaColors.bold((", ".join(in_deploy_not_marathon_chronos))))
        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 or chronos entry"))
        if len(marathon_steps) > 0:
            paasta_print(success("All marathon instances have a corresponding deploy.yaml entry"))
        if len(chronos_steps) > 0:
            paasta_print(success("All chronos instances have a corresponding deploy.yaml entry"))
    return the_return