Skip to content

Instantly share code, notes, and snippets.

@koonagi
Created February 16, 2020 13:41
Show Gist options
  • Save koonagi/0d744174d9c002810ced0dc2d8c5e5c6 to your computer and use it in GitHub Desktop.
Save koonagi/0d744174d9c002810ced0dc2d8c5e5c6 to your computer and use it in GitHub Desktop.
import boto3
lambda_client = boto3.client('lambda')
codepipeline_client = boto3.client('codepipeline')
def lambda_handler(event, context):
try:
###
# Get CodepipeLine Job ID
###
job_id = event['CodePipeline.job']['id']
###
# TODO implement
###
###
# Response job result(success) to codepipeline
###
codepipeline_client.put_job_success_result(jobId=job_id)
except Exception as e:
###
# Response job result(failure) to codepipeline
###
codepipeline_client.put_job_failure_result(
jobId=job_id,
failureDetails={
'type': 'JobFailed',
'message': str(e)
}
)
raise Exception(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment