# CodePipeline

## Icon

![CodePipeline Icon](https://icon.icepanel.io/AWS/svg/Developer-Tools/CodePipeline.svg)

## About

* Visual Workflow to orchestrate CI/CD.
  * **Code Repository:** Source of code repository could be `GitHub`, `CodeCommit`, `GitLab` etc.
  * **Built:** Built phase can be triggered using `CodeBuild`, `Jenkins`, `CloudBees` etc
  * **Test:** - Third party tools can be used for testing.
  * **Deploy:** - `CodeDeploy`, `Elastic BeanStalk`, `CloudFormation`, `ECS` etc can be used.
  * **Invoke:** - To invoke lambda, step functions etc.
* These orchestrator has stages
  * **Each stage can have sequential/parallel action**s.
  * Manual approval action can be defined at any stages if required.
  * Each stage generates artifacts which can be passed on to next stage. The artifacts generated during different stages are stored in `S3`.

## Trouble shooting

* To get insight to state changes in CodePipeline use CloudWatch Events i.e EventBridge.
* If any stage fails then information about failure can be obtained in console.
* Ensure relevant IAM roles are provided to CodePipeline so as the pipeline to execute successfuly.
* AWS CloudTrail can be used to audit AWS API calls.

## A typical flow diagram

![Code Pipeline](https://574639531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJDnjsv52I3fJ56WbLgHu%2Fuploads%2Fgit-blob-03cdcd9e84f348c80ae6cedfe1bd528aaf280266%2FAWS_CodePipeline_Integration.png?alt=media)
