@@ -201,120 +201,6 @@ Resources:
201201 Type : Custom::InvokeImageBuildLambda
202202 Properties :
203203 ServiceToken : !GetAtt ImageBuildLambda.Arn
204-
205-
206- # RuleSignalCFNPostImageBuild:
207- # Type: AWS::Events::Rule
208- # DependsOn:
209- # - InvokeImageBuild
210- # - ImageBuildWaitHandle
211- # Properties:
212- # Description: "Event rule to signal cloudformation of image build activity"
213- # EventPattern:
214- # source:
215- # - "aws.codebuild"
216- # detail-type:
217- # - "CodeBuild Build State Change"
218- # detail:
219- # build-status:
220- # - "SUCCEEDED"
221- # - "FAILED"
222- # - "STOPPED"
223- # build-id:
224- # - !GetAtt InvokeImageBuild.buildid
225- # State: ENABLED
226- # Targets:
227- # - Arn: !GetAtt ImageBuildCompletionCheckLambda.Arn
228- # Id: "invoke-cfn-signal-lambda"
229- #
230- # InvokeLambdaFunctionPermission:
231- # Type: AWS::Lambda::Permission
232- # Properties:
233- # FunctionName: !GetAtt ImageBuildCompletionCheckLambda.Arn
234- # Action: lambda:InvokeFunction
235- # Principal: events.amazonaws.com
236- # SourceArn: !GetAtt RuleSignalCFNPostImageBuild.Arn
237- #
238- # ImageBuildCompletionCheckLambda:
239- # Type: 'AWS::Serverless::Function'
240- # DependsOn:
241- # - InvokeImageBuild
242- # - ImageBuildWaitHandle
243- # Properties:
244- # Handler: index.lambda_handler
245- # InlineCode: |
246- # import json
247- # import logging
248- # import os
249- # import uuid
250- #
251- # import urllib3
252- #
253- # code_build_project_name = os.environ['CODEBUILD_PROJECT']
254- # code_build_id = os.environ['CODEBUILD_ID']
255- # cfn_handle = os.environ['CFN_HANDLE']
256- # logger = logging.getLogger()
257- # logger.setLevel(logging.INFO)
258- #
259- #
260- # def lambda_handler(event, context):
261- # logger.info('got event {}'.format(event))
262- # build_status = event['detail']['build-status']
263- # uuid_value = uuid.uuid1()
264- # data = {"Reason": f"Image Build Completed with status {build_status}",
265- # "UniqueId": uuid_value,
266- # "Data": f"Image Build Completed with statsus {build_status}"}
267- # if build_status == 'SUCCEEDED':
268- # data["Status"] = "SUCCESS"
269- # else:
270- # data["Status"] = "FAILURE"
271- # logger.info('Code build is complete')
272- # logger.info('Send signal back to cfn stack')
273- # http = urllib3.PoolManager()
274- # response = http.request("POST",cfn_handle, fields=json.dumps(data))
275- # logger.info(response)
276- #
277- # Runtime: python3.8
278- # Description: A function that runs the code build project.
279- # Policies:
280- # - Statement:
281- # - Action:
282- # - codebuild:StartBuild
283- # - codebuild:Get*
284- # - codebuild:List*
285- # Effect: Allow
286- # Resource: !GetAtt SparkOnLambdaCodeBuild.Arn
287- # Version: '2012-10-17'
288- # - Statement:
289- # - Action:
290- # - iam:PassRole
291- # Effect: Allow
292- # Resource: !GetAtt SparkOnLambdaImageCodeBuildRole.Arn
293- # Version: '2012-10-17'
294- # - Statement:
295- # - Action:
296- # - logs:*
297- # - codebuild:BatchGetBuild
298- # Effect: Allow
299- # Resource: "*"
300- # Version: '2012-10-17'
301- # Environment:
302- # Variables:
303- # CODEBUILD_PROJECT: !Ref SparkOnLambdaCodeBuild
304- # CODEBUILD_ID: !GetAtt InvokeImageBuild.buildid
305- # CFN_HANDLE: !Ref ImageBuildWaitHandle
306- #
307- # ImageBuildWaitHandle:
308- # Type: AWS::CloudFormation::WaitConditionHandle
309- #
310- #
311- # ImageBuildWaitCondition:
312- # Type: AWS::CloudFormation::WaitCondition
313- # Properties:
314- # Count: 1
315- # Handle: !Ref ImageBuildWaitHandle
316- # Timeout: 600
317-
318204Outputs :
319205 ImageRepoName :
320206 Description : ECR image Repository
0 commit comments