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 processCodeBuild(event): event_id = event['detail']['build-id'].split('/')[1] build_status = codebuild_client.batch_get_builds(ids=[event_id]) pid = event_id.split(':')[1] or None if not pid: return pipeline_name = event_id.split(':')[0] cbi = CodeBuildInfo(build_status['builds'][0]['initiator'][13:], event_id) (stage, pid, actionStates) = pipelineFromBuild(cbi) buildInfo = BuildInfo(pid, pipeline_name) existing_msg = find_message_for_build(buildInfo) builder = MessageBuilder(buildInfo, existing_msg) phases = build_status['builds'][0]['phases'] builder.updateBuildStageInfo(stage, phases, actionStates) logs = build_status['builds'][0].get('logs', {}) try: if logs['streamName']: builder.attachLogs(logs) except KeyError: pass post_build_msg(builder)
def processCodeBuild(event): # logger.info("processCodeBuild") if is_skip_codebuild_notice(event['detail'].get('eventName')): return cbi = CodeBuildInfo.from_event(event) (stage, pid, actionStates) = pipelineFromBuild(cbi) if not pid: return build_info = BuildInfo(pid, cbi.pipeline, actionStates) 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.updateBuildStageInfo(stage, phases, actionStates) logs = event['detail'].get('additional-information', {}).get('logs') if logs: builder.attachLogs(event['detail']['additional-information']['logs']) post_build_msg(builder)
def processCodePipeline(event): buildInfo = BuildInfo.fromEvent(event) existing_msg = find_message_for_build(buildInfo) builder = MessageBuilder(buildInfo, existing_msg) builder.updatePipelineEvent(event) if builder.needsRevisionInfo(): revision = findRevisionInfo(buildInfo) builder.attachRevisionInfo(revision) post_build_msg(builder)
def process_code_pipeline(event): if 'execution-id' not in event['detail']: logger.debug("Skipping due to no executionId") return build_info = BuildInfo.from_event(event) existing_msg = find_message_for_build(build_info) builder = MessageBuilder(build_info, existing_msg) builder.update_pipeline_event(event) if builder.needs_revision_info(): revision = find_revision_info(build_info) builder.attach_revision_info(revision) post_build_msg(builder)
def processCodePipeline(event): # logger.info("processCodePipeline") if is_skip_codepipeline_notice(event['detail'].get('eventName')): return build_info = BuildInfo.from_event(event) existing_msg = find_message_for_build(build_info) # logger.info("existing_msg: {}".format(existing_msg)) builder = MessageBuilder(build_info, existing_msg) builder.updatePipelineEvent(event) if builder.needsRevisionInfo(): revision = findRevisionInfo(build_info) builder.attachRevisionInfo(revision) post_build_msg(builder)
def processCodeBuild(event): cbi = CodeBuildInfo.fromEvent(event) (stage, pid, actionStates) = pipelineFromBuild(cbi) if not pid: return buildInfo = BuildInfo(pid, cbi.pipeline) existing_msg = find_message_for_build(buildInfo) builder = MessageBuilder(buildInfo, existing_msg) if 'phases' in event['detail']['additional-information']: phases = event['detail']['additional-information']['phases'] builder.updateBuildStageInfo(stage, phases, actionStates) # logs = event['detail'].get('additional-information', {}).get('logs') # if logs: # builder.attachLogs(event['detail']['additional-information']['logs']) post_build_msg(builder)