def process_code_build(event): if 'additional-information' not in event['detail']: logger.debug("Skipping due to no additional-information") return cbi = CodeBuildInfo.from_event(event) logger.debug(vars(cbi)) (stage, pid, actionStates) = pipeline_from_build(cbi) logger.debug(stage, pid, actionStates) if not pid: return build_info = BuildInfo(pid, cbi.pipeline) existing_msg = find_message_for_build(build_info) builder = MessageBuilder(build_info, existing_msg) if 'phases' in event['detail']['additional-information']: phases = event['detail']['additional-information']['phases'] builder.update_build_stage_info(stage, phases, actionStates) logs = event['detail'].get('additional-information', {}).get('logs') post_build_msg(builder)
def process_code_build(event): pipeline_name, build_id, build_project_name = get_codebuild_from_pipeline_metadata(event) stage_name, pipeline_execution_id, action_state = find_pipeline_from_build(pipeline_name, build_id) if not pipeline_execution_id: return message = find_slack_message_for_update(pipeline_execution_id) message_builder = MessageBuilder(message, pipeline_execution_id, pipeline_name) if is_codebuild_phases_updatable(event): phases = get_codebuild_phases(event) message_builder.update_build_stage_info(stage_name, phases, action_state, build_project_name) post_message(message_builder=message_builder)