Hi, I am writing CodeCommit and CodePipeline project with CDK.
But I am facing an issue:
When the pipeline is created for the first time, it starts automatically and always fails at the build stage with an error.
If I restart the pipeline from the Management Console, it runs without any errors.
- First run -> fail at the build stage
- Restart pipepine manually -> build success
The error message is
Error calling startBuild: User: arn:aws:sts::111111111111:assumed-role/blabla-XXXXXXX/nnnnnn is not authorized to perform: codebuild:StartBuild on resource: arn:aws:codebuild:ap-northeast-1:111111111111:project/SampleBuildProject because no identity-based policy allows the codebuild:StartBuild action (Service: AWSCodeBuild; Status Code: 400; Error Code: AccessDeniedException; Request ID: xxx; Proxy: null)
I confirmed that the role had 'startBuild' action.
I think it happens because the pipeline deployment is still running when the first build runs.
Is there any solution to avoid this?
Thanks!