0
votes

I integrated my GitHub repository with AWS Codepipeline and that with Jenkins through the AWS Codepipeline plugin in Jenkins. Jenkins is installed in an EC2 server. I created an IAM role for the EC2 instance holding my Jenkins. I also set up AWS CodePipeline Publisher as the post build action.

However, my code from GitHub is taken in by AWS Codepipeline successfully(The Source stage is successfull), but the Build stage fails with a Timeout error after 1 hour.

When I checked with the Jenkins workspace in the EC2 instance, the workspace for the project is empty.

That is, the code taken in from GitHub is not put into the workspace of Jenkins by the AWS Codepipeline.

Is this a problem with enabling security for Jenkins? But actually I tried with disabling the security as well. But I got the same error.

Your help is really appreciated.

3

3 Answers

0
votes

in the Build Triggers section, did you choose Poll SCM?

This is where you configure how often Jenkins should poll AWS CodePipeline for new tasks. For example: H/5 * * * * (every 5 minutes).

Something else that comes to mind is an issue with the credentials. If you open your Jenkins project, there should be an AWS CodePipeline Polling Log link on the left, below "Configure", and you should see an error there if the plugin is unable to poll.

0
votes

First thing - Make sure Jenkins running on EC2 instance have IAM role and its related permissions to perform actions with AWS Code Pipeline.

Second thing - Under Build Triggers section, select Poll SCM and type five asterisks separated by spaces in Schedule.

Kindly follow the link for more details http://docs.aws.amazon.com/codepipeline/latest/userguide/getting-started-4.html#getting-started-4-get-instance

0
votes

This is an old question but had the same problem. After quite a bit of research, I figured out that in my setup, the input and output artifact names were missing.

Steps to check / fix the issue You will need the aws cli installed. Use: aws codepipeline get-pipeline --name [pipeline name] > pipeline.json open the pipeline and confirm that 1. the output artifact in the source stage is the same as the input artifact in the build stage. 2. the output artifact in the build stage is the same as the input artifact in the Beta (or whatever is your deploy stage) stage.

You can check whether things are working fine by going to your S3. In the bucket for your code pipeline, you should see a folder with the same name as the output artifact in your source stage. Inside this, there will be various zip files. Download one and unzip to check that the upload from GitHub was proper.

I am guessing that the issue happened for me because I began with a 2 step pipeline and then added the build process afterwards - May happen with you too if you do not have the Jenkins server ready before creating the pipeline and hence you put that stage later.