Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS codebuild fails cant download source when initiated from codepipeline

I have a an AWS codebuild job that works fine when I initate manually as a root user.

I have a codepipe line that should initiate the build job when codecommit merges into master. It fires the job and the build start but it fails when trying to download source.

Ive attached full S3/codebuild/codecommit policies to the pipeline, but it still throws access denied.

Which permissions am I missing?

like image 732
user618509 Avatar asked Jan 24 '18 18:01

user618509


People also ask

Does CodePipeline use CodeBuild?

CodePipeline integrates with multiple AWS and third-party services, including GitHub, AWS CodeCommit, CodeBuild, AWS CloudFormation, Amazon S3, and many others.

What is the difference between CodeDeploy and CodePipeline?

CodePipeline builds, tests, and deploys your code every time there is a code change, based on the release process models you define. AWS CodeDeploy belongs to "Deployment as a Service" category of the tech stack, while AWS CodePipeline can be primarily classified under "Continuous Deployment".

Is not authorized to perform CodePipeline?

I am not authorized to perform an action in CodePipeline If the AWS Management Console tells you that you're not authorized to perform an action, you must contact your administrator for assistance. Your administrator is the person who provided you with your user name and password.


1 Answers

This generally happens when you have a CodeBuild project already and you integrate it to the CodePipeline project. The Codebuild now does not download the sources from CodeCommit/Github repo. Instead, it will try to dowload the source artifact created in the codepipeline bucket in S3. So, you will need to provide permissions to the CodeBuild role to access the codepipline bucket in S3.

You can do this by modifying Codebuild role's attached policy (or attaching a new policy) that gives access to the following operations

s3:ListObjects
s3:GetObject
s3:ListBucket

for your Codepipeline bucket and its objects

"arn:aws:s3:::codepipeline-bucket",
"arn:aws:s3:::codepipeline-bucket/*"

Or you can just choose to add all operations for this bucket and its object. You can release the changes and it would work. Lmk if it does not.

like image 140
stelo Avatar answered Sep 24 '22 18:09

stelo