The mechanism described in the companion blog still works, but the sample code in this repo is no longer maintained. It is recommended that you use Amazon CodeCatalyst to simplify the configuration and archive the same workflow.
Now this best practice model works on both AWS Global and AWS China regions.
The complete walkthrough can refer to this blog post.
AWS CodeCommit is a managed, secure and git based source code management service. AWS CodeCommit helps enterprise users to set up secure and managed SCM. Though it does not provide the social related features(such as forking and liking) in Github or Gitlab. It can easily work like Gerrit Code Review for team collobration in any size, which is thoroughly used by Android and the projects under Eclipse Foundation.
This best practice model consists of below guidelines and workflows,
- The Collaborator role of AWS CodeCommit repos who only has permissions for pulling repo, pushing/merging code to specific branches(the branch name with prefix
pr/
,features/
andbugs/
), and creating/closing/commenting pull requests. - The Master/Owner role of AWS CodeCommit repos who has some additional administrative privilleges of repo, such as updating repo info, approving/merging pull requests.
- Nobody can directly push code to mainline branch including master/owner of repos.
- Any newly created pull request and updating of source branch of pull request will trigger automatically CodeBuild to verify the pull request. The CodeBuild will update the PR build status back to pull request and vote code review apporval
+1
if the build is successful. - The approval rule template is created and assoicated with the repo. The approval rule requires at least two
+1
approvals from master/owner of repo and the automated PR build. - The CodePipeline is created on watching the mainline branch of repo. When new changes are merged into mainline branch, the continuous delivery pipeline will be triggered to deploy the artifacts of repo.
See entire architecture below,
This model also leverages the Infra as Code capability of AWS via AWS CDK/CloudFormation, hundreds or more code repositories and their collaboration workflow can be easily managed in a batch.
- Install Node LTS(such as 12.x)
- Install Docker
- Configure your AWS account for awscli
# install dependencies of lambda functions, init cdk toolkit
npm run init
# deploy
npm run deploy
npm run cleanup
This sample code is made available under the MIT-0 license. See the LICENSE file.