AWS Open Source Blog

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.

Asif Khan


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.

Solution Overview

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.

integrating Phabricator into a CI/CD pipeline.

Step by Step

Step 1: Set up Phabricator. See the Phabricator Installation Guide for detailed steps.

Step 2: Integrate Phabricator repository with AWS CodeCommit

  1. Go to the AWS Management Console, choose CodeCommit, create a CodeCommit Repository, and Copy the SSH URI.
  2. Create the Repository URI: in your Phabricator repository, click Manage Repository -> URIs -> Add New URI.
  3. Input the SSH URI for the CodeCommit Repository.
  4. Select Mirror as the desired I/O type.

Create Repository URI dialog.

  1. Select desired Display Type. In this implementation we selected “Hidden: Do not show as a clone url.”
  2. 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.

Conclusion

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.

Junaid Kapadia.

Junaid Arif Kapadia

Junaid Arif Kapadia is a Staff Software Engineer and an Engineering Manager with Aetion Inc. He delivers cloud, on-premise and hybrid solutions while leading a team of engineers that practice the philosophy of DevSecOps. He holds a B.S in Information Technology Systems and an M.S in Information Systems with concentrations in Technology Management and Cloud Computing.

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.

Asif Khan

Asif Khan

Asif is a Solutions Architect at AWS. He is a frequent contributor, advisor, speaker on artificial intelligence and developer experience. He has helped multiple customer transformations, and is deeply passionate about developer experience and open source. Asif has several patents,domain journal publications, and has reviewed Linux System Administrator Handbook

Kausalya Rani Krishna Samy

Kausalya Rani Krishna Samy

Kausalya Rani Krishna Samy is a DevOps technologist at Amazon Web Services helping customers on their journey to adopting cloud native solutions. She leads DevOps and Big Data projects, builds proof of concepts and enjoys solving architectural challenges using cloud native solutions with an automate-everything approach. In her free time, she paints, travels and does photography.