Integrating Phabricator with AWS CodePipeline via AWS CodeCommit
Realizing true DevOps culture means implementing a continuous integration and continuous delivery (CI/CD) pipeline from development to production, often integrating popular open source tools with cloud services such as AWS CodeCommit and AWS CodePipeline. In this post, Junaid Kapadia shows how to integrate Phabricator, an open source code manager, into a cloud-based CI/CD pipeline.
The Aetion Evidence Platform analyzes real-world data to provide the evidence needed to make regulatory-grade decisions to improve healthcare. The platform generates real-world evidence at the granularity needed to assess the expected and realized value of treatments, and at the speed required for real-time collaboration across the healthcare ecosystem.
Phabricator is a scalable, fully open source, web-based software development suite used to manage sprints, review code, track defects, host repositories like git, svn or Mercurial, build with continuous integration, review designs, collaborate with team members, etc. As part of their internal workflow, Aetion used a self-hosted version of Phabricator for source code management with git-based revision control.
Aetion is now moving to the cloud. As part of that journey, we needed to build a new CI/CD pipeline using AWS Developer Tools such as AWS CodeCommit and AWS CodePipeline. To avoid disrupting existing workflows, we needed to integrate Phabricator into this new pipeline.
In AWS CodePipeline, a Source Stage is the initial trigger for events in the workflow. Source Stages currently supported include S3, Github, and CodeCommit, but at the moment Phabricator is not supported natively as a Source Stage. In order to continue using Phabricator’s review features and not break our existing developer workflow, we had to find a way to integrate Phabricator with AWS CodePipeline via AWS CodeCommit.
We decided to use a self-hosted version of Phabricator for revision control in a private VPC on AWS, and integrate it with AWS CodeCommit. In this design, the continuous delivery pipeline is triggered and managed through Phabricator.
Phabricator has multiple URI-specific options that provide a variety of features. One such feature is the ability to mirror repositories. Aetion created an empty CodeCommit repository in the AWS Account and mirrored the Phabricator Repository to it. As a result, each commit to the Phabricator repository would result in a mirror commit to the CodeCommit repository. By using this simple integration method, Aetion was able to use AWS CodeCommit as the source stage and deploy applications using AWS CodePipeline.
Step by Step
Step 1: Set up Phabricator. See the Phabricator Installation Guide for detailed steps.
Step 2: Integrate Phabricator repository with AWS CodeCommit
- Go to the AWS Management Console, choose CodeCommit, create a CodeCommit Repository, and Copy the SSH URI.
- Create the Repository URI: in your Phabricator repository, click Manage Repository -> URIs -> Add New URI.
- Input the SSH URI for the CodeCommit Repository.
- Select Mirror as the desired I/O type.
- Select desired Display Type. In this implementation we selected “Hidden: Do not show as a clone url.”
- After creating the new URI, click Update Credential -> Add Credential. Add the SSH Private Key that can access the CodeCommit repository, and specify the IAM user. The user will need to generate an SSH KeyPair and attach it to an IAM User that has access to the appropriate CodeCommit repository in use.
Now, each push to the Phabricator repository will result in a push to the corresponding CodeCommit repository. This allows you to base your Pipeline triggers off Phabricator repository commits without modifying the underlying developer workflow. You can then follow the steps to Create a Simple Pipeline.
With the above design, we were able to successfully integrate our existing development workflow without impacting our productivity levels. This integration allowed us to continue with our migration journey from a Chef, Jenkins, and EC2-based architecture to a fault-tolerant, highly available, continuously provisioned and deployed architecture via AWS CodePipeline, AWS CodeBuild, AWS CloudFormation, AWS Systems Manager Parameter Store, and Amazon Elastic Container Service (Amazon ECS). You can learn more about that journey in our 2018 re:Invent session, Aetion’s Journey to AWS CodePipeline, AWS CloudFormation, & Amazon ECS.
The content and opinions in this post are those of the third-party author and AWS is not responsible for the content or accuracy of this post.