33
AWS CI/CD pipeline with CodeGuru & UnitTest
This post explains how to build a CI/CD pipeline using AWS services. It also explains how to organize various ways to improve code quality (CodeReview & UnitTest) in the AWS pipeline.
It covers simple branch build and deployment, UnitTest report, and CodeGuru which automatically performs code review when create pull-requests.

You can use the AWS Code Series. Code series is a fully managed service, so there is no need for a infrastructure.
CodeBuild: AWS CodeBuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy.
CodeDeploy: AWS CodeDeploy is a fully managed deployment service that automates software deployments to a variety of compute services such as Amazon EC2, AWS Fargate, AWS Lambda, and your on-premises servers.
CodePipeline: AWS CodePipeline is a fully managed continuous delivery service that helps you automate your release pipelines for fast and reliable application and infrastructure updates.
Amazon CodeGuru is a machine learning service for automated code reviews and application performance recommendations.
It helps you find the most expensive lines of code that hurt application performance and keep you up all night troubleshooting, then gives you specific recommendations to fix or improve your code. It supports JAVA, repository can use GitHub or CodeCommit. It is also easy to integrate.

Amazon CodeGuru Reviewer finds issues in your code and recommends how to remediate them.

The contents that CodeGuru Reviewer detects can be this categories.
Concurrency : CodeGuru Reviewer identifies problems with implementations of concurrency in multithreaded code
Resource Leaks : CodeGuru Reviewer looks for lines of code where resource leaks might be occurring.
Sensitive Information Leak : Sensitive information in code should not be shared with unauthorized parties.
Amazon CodeGuru Profiler is always searching for application performance optimizations, identifying your most expensive lines of code and recommending ways to fix them to reduce CPU utilization, cut compute costs, and improve application performance.
~ git clone https://github.com/aws-samples/amazon-cicd-concurrency-sample-application.git

~ cd amazon-cicd-concurrency-sample-application
~ git checkout origin/develop -b develop

go to the CloudFormation console : https://console.aws.amazon.com/cloudformation


Entering the following in the terminal of Cloud9. is the changeCodeCommit copied from the Stack of CloudFormation.
~ git remote set-url origin <YOUR-REPOSITORY-URL>
After finished the command, check again with git remote show origin, and you can see that the URL of origin has been changed to your CodeCommit address.
After that, you can checkout to master branch first then push commits. Then, develop branch and push commits.
~ git checkout master
~ git push
~ git checkout develop
~ git push








Profiler can be found in the main of the source code, ConcurrencyCheckout.java.
Now CodeGuru profiler and instance is complete.



Now let’s go back to Cloud9 and edit buildspec.yml. buildspec.yml is located in ConcurrencySample’s root directory.
Double-click the file to add content. Paste the Report group ARN to .
yml
reports:
<YOUR-REPORT-GROUP-ARN>:
files:
- '**/*'
base-directory: 'build/test-results/test'
~ cd amazon-cicd-concurrency-sample-application
~ git add .
~ git commit -m "change Buildspec.yml"
~ git push
Now we finished the first part in this series.
33