Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating Github Enterprise with AWS Codepipeline

I have a repository in a [company hosted] GitHub enterprise site that I need to integrate within a CI/CD pipeline in AWS using the CodePipeline service. The CodePipeline service then will connect with a Jenkins Service running in an EC2 instance. I am following this AWS documentation to do this.

Note that this is an enterprise GitHub repo and not hosted on GitHub.com.

I am unable to connect to the GitHub Enterprise site in the "Create a pipeline" wizard. Selecting GitHub as a source only lets me connect to GitHub.com, and not to my organization's enterprise site.

How do I connect to the enterprise GitHub site so that I can add the repo as a source for my codepipeline?

like image 354
sidx64 Avatar asked Nov 17 '18 13:11

sidx64


People also ask

How do I link AWS CodeBuild to GitHub?

Connect GitHub with an access token (console)For Source provider, choose GitHub. For Repository, choose Connect with a GitHub personal access token. In GitHub personal access token, enter your GitHub personal access token. Choose Save token.

Can you connect GitHub to AWS?

You can use the AWS Command Line Interface (AWS CLI) to create a connection to GitHub. To do this, use the create-connection command. A connection created through the AWS CLI or AWS CloudFormation is in PENDING status by default.


2 Answers


UPDATE: An integration was finally released for github enterprise to work with AWS Codepipeline. Please see this answer by Pedreiro


As Sid Malani said in the comments, there's no straightforward or direct way to use a privately hosted GitHub Enterprise Repository in AWS CodePipeline.

One way would be to use CodeBuild, which allows to add custom github repositories which can then be used in CodePipeline. This, however, should only be considered as a stop-gap solution.

Thank you Sid Malani for the alternative strategy

like image 106
sidx64 Avatar answered Sep 18 '22 13:09

sidx64


I doubt AWS will ship this feature anytime soon (hopefully I eat my words) since the workaround is well-documented and works fine. The gist of it can be found here, which I'll summarize as follows:

  1. Create a CodeBuild project (which can take GitHub Enterprise as a source) which essentially just listens to a push event (webhook) of your development or master branch and outputs a .zip file of the source-code into an S3 bucket.
  2. Use the S3 bucket as the source of your CodePipeline.
like image 44
papiro Avatar answered Sep 20 '22 13:09

papiro