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
def missing_deployments_message(service): jenkins_url = PaastaColors.cyan( 'https://jenkins.yelpcorp.com/view/services-%s' % service) message = "%s No deployments in deployments.json yet.\n " \ "Has Jenkins run?\n " \ "Check: %s" % (x_mark(), jenkins_url) return message
def validate_status_something_fail(context): assert x_mark() in context.validate_output
def validate_status_all_pass(context): assert not context.validate_output or x_mark() not in context.validate_output
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['instancename'] for step in pipeline_deployments] pipeline_steps = [step for step in pipeline_steps if step not in DEPLOY_PIPELINE_NON_DEPLOY_STEPS] 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
def validate_status_something_fail(context): assert x_mark().decode('utf-8') in context.validate_output
def validate_status_all_pass(context): assert not context.validate_output or x_mark().decode('utf-8') not in context.validate_output
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['instancename'] for step in pipeline_deployments] pipeline_steps = [ step for step in pipeline_steps if step not in DEPLOY_PIPELINE_NON_DEPLOY_STEPS ] 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 add entries to deploy.yaml for them so they" print " 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_marathon_not_deploy)) print " You should probably add entries to deploy.yaml for them so they" print " 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
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