Technology

AWS CodePipeline Introduction

AWS
2021/12/03

What is CI/CD?

In a fast developing cycle, keep approving result each time in order to develop a product that meet the requirement as fast as possible, or according the result to keep correcting and improving the developing process. These approving and correcting process need to run repeatedly and continuously, if these processes can be run by automatic tool, then the whole developing process will be more efficiency, and we call this automatic process CI/CD.

 

What is CodePipeline?

AWS provide many CI/CD Pipeline developer tools, CodePipeline is one of them, it can use AWS CodeCommit or another external source, to deploy source code in AWS, and trigger Pipeline to run.

 

AWS CodeBuild can run code, construct application, do anything you need to do in pipeline. When pipeline is processing, you can trigger Lambda function to run anytime, to increase availability of pipeline. There are a lot service can integrate with pipeline, such as CodeDeploy, Elastic Beanstalk, ECS and Fargate. CodePipeline provide strong ability of integration, ensure to meet your requirement in any scenario. CodePipeline only charge how many pipeline you use, not included CodeBuild running time or S3 usage.

 

Structure of CodePipeline

Every single CodePipeline Instance called Pipeline. It have every option setting inside of it, each Pipeline has 2 to 10 steps. A Pipeline can pass their previous state between every actions and stages. Your source code, Pipeline state, file or built application binary file, everything are store into S3 Bucket. This is the fundamental mode how your process interacting with others in CodePipeline.

 

Any input or output artifacts is defined inside of the process, and use a unique name to describe it. If you want to get an artifact from previous output, just use it as input artifact name, CodePipeline will find it from Pipeline data in S3 Bucket.

 

Pipeline’s option settings

Pipeline needs a name to identify itself, and it is unique in your AWS account region. Every Pipeline needs a service role, for access Lambda, S3, CodeCommit or many other resources can interact with CodePipeline. You will need to create or assign a S3 bucket to store Artifacts that use as input or output through stages and Pipeline produce and being use. You can also assign your own KMS encryption key to Artifacts in S3 bucket, or just use default key instead. Beside these option settings, every Pipeline also included information from other stages.

 

Pipeline Stage

Stage is a set of actions. You can combined or separate different type of actions with any standard. For example:

◆ Source stage included an action that a source code are pulled by Source code control, and another action output from Source code artifact.

◆ Build stage included multiple actions, such as receive Source code artifacts, execution command and construct command for source code. ;

All stages can be used to build your Pipeline. The only requirement you must meet is in first stage, it must include at least one source code action, and other stages don’t have any requirement. Each stage at least have one action and up to 50 actions. Combined by different actions, every action have its own specific type of function to run.

 

Action type in CodePipeline

Source Action Type

This kind of action type can only use in first stage, import source code from source control like Jenkins or AWS CodeCommit. Next action type will be build type, it can execute source code in supported environment, supported environment is the place you want to build your application in or compile your source code. You also can run any source code in CodeBuild if needed.

 

Test Action Type

One of important part in automatic deployment is automatic test. Test action type can be preform in different platform included various of third-party tools, of cause AWS CodeBuild can help executing your test.

 

Deploy Action Type

You can deploy your source code in deploy action type. There are many AWS services to help you deploy your application too, such as ECS, ElasticBeanstalk or Code Deploy.

 

There are two more type of actions can help with CI/CD. First one is approval action type, it allow you add a manually approving step in your Pipeline. When you deploy your Pipeline into an online environment, and hoping before the new version of application go online do a quick smoke test, CodePipeline can also help to finish the task.

Contact Us