aws-samples / aws-codepipeline-custom-action

Amazon EC2 build environments with AWS CodePipeline and custom actions
MIT No Attribution
12 stars 18 forks source link

stack failed to deploy, could you please help? #8

Open jjin-jeff opened 5 months ago

jjin-jeff commented 5 months ago

{ "StackId": "arn:aws:cloudformation:us-east-1:851725632079:stack/custom-codepipeline/c942e780-ed6c-11ee-a5e1-12a65c777423", "EventId": "de346290-ed6c-11ee-83eb-0eca71e7d4e9", "StackName": "custom-codepipeline", "LogicalResourceId": "custom-codepipeline", "PhysicalResourceId": "arn:aws:cloudformation:us-east-1:851725632079:stack/custom-codepipeline/c942e780-ed6c-11ee-a5e1-12a65c777423", "ResourceType": "AWS::CloudFormation::Stack", "Timestamp": "2024-03-29T01:37:13.519000+00:00", "ResourceStatus": "ROLLBACK_IN_PROGRESS", "ResourceStatusReason": "The following resource(s) failed to create: [RunBuildJobOnEc2Instance, InstanceApiExecutionRole, JobCompletionHandler, Ec2BuilderInstanceProfile]. Rollback requested by user." },

nikfio commented 2 weeks ago

Hello @jjin-jeff ,

also I had failures in executing deploy stage with this command:

aws cloudformation deploy --template-file .\deployment.yml --capabilities CAPABILITY_NAMED_IAM --stack-name win-codebuild-action-stack --parameter-overrides CustomActionProviderVersion=1

by exporting logs with this command

I looked in and found :

{
     "StackId": "arn:aws:cloudformation:eu-central-1:755575177725:stack/win-codebuild-action-stack/bf08ba50-6392-11ef-a366-06f29093cfd1",
     "EventId": "JobCompletionHandler-CREATE_FAILED-2024-08-26T10:06:44.416Z",
     "StackName": "win-codebuild-action-stack",
     "LogicalResourceId": "JobCompletionHandler",
     "PhysicalResourceId": "win-codebuild-action-stack-JobCompletionHandler-heMi261G4Yo8",
     "ResourceType": "AWS::Lambda::Function",
     "Timestamp": "2024-08-26T10:06:44.416000+00:00",
     "ResourceStatus": "CREATE_FAILED",
     "ResourceStatusReason": "Resource handler returned message: \"The runtime parameter of python3.7 is no longer supported for creating or updating AWS Lambda functions. We recommend you use a supported runtime while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 7fa415d6-4ffc-498c-8c78-d214e8d840b1)\" (RequestToken: f543e3ec-b6b2-4749-8a32-243e74b25e5c, HandlerErrorCode: InvalidRequest)",
     "ResourceProperties": "{\"Role\":\"arn:aws:iam::755575177725:role/win-codebuild-action-stac-JobCompletionHandlerExecu-laPRrOwQYmME\",\"MemorySize\":\"128\",\"Runtime\":\"python3.7\",\"Description\":\"Handles result of job flow execution.\",\"Timeout\":\"15\",\"Handler\":\"lambda.lambda_handler\",\"Code\":{\"S3Bucket\":\"win-codebuild-action-bucket\",\"S3Key\":\"404701f1fa42de050caac322e9bdd119\"},\"Tags\":[{\"Value\":\"SAM\",\"Key\":\"lambda:createdBy\"}]}"
}

then in template.yml I replaced every python3.7 with python3.10 . Launched back again the package command and then the deploy command and It successfully deployed (created/updated) the stack.

In your deploy fail logs, what does it say about in "LogicalResourceId": "JobCompletionHandler" stage ? Anyways, if not exactly equal error, I would look into parameters values in template.yaml, they may be became obsolete since last commit is now 4 years old.

Hope my attempt helps you.

Nick