rerun_pipeline.py 673 B

1234567891011121314151617181920212223242526272829
  1. import boto3
  2. from crhelper import CfnResource
  3. from decorators import with_logging
  4. helper = CfnResource(json_logging=False, log_level="DEBUG", boto_level="CRITICAL")
  5. pipe_client = boto3.client("codepipeline")
  6. @with_logging
  7. @helper.create
  8. @helper.delete
  9. def create(event, context):
  10. return None
  11. @with_logging
  12. @helper.update
  13. def update(event, context):
  14. props = event["ResourceProperties"]
  15. props_old = event["OldResourceProperties"]
  16. if props_old["DeployWebUI"] == "false" and props["DeployWebUI"] == "true":
  17. pipe_client.start_pipeline_execution(name=props["PipelineName"])
  18. return None
  19. def handler(event, context):
  20. helper(event, context)