ยท 1 min read

Code Pipeline

Code Pipeline

Learn how to automate your software release process with AWS CodePipeline, from GitHub integration to build automation and deployment strategies.

CodePipeline automates software release process. CodePipeline allows for modeling different stages of a release process. CodePipeline can be extended to adapt to the release.

  • Pull source from GitHub
  • Use an on-premises build sever
  • Inform custom dashboards

Example CodePipeline

A CodePipeline consists of a source, either from an Amazon S3 bucket, AWS CodeCommit, or GitHub, and one or more build projects. In the following example a CodePipeline monitors a GitHub repository for changes. When changes are detected the pipeline will install the necessary dependencies and build the project.

BuildPipeline:
  Type: AWS::CodePipeline::Pipeline
  Properties:
    Name: BuildPipeline
    Stages:
      ...

GitHub Source Action

The first stage of the pipeline retrieves the source from GitHub. AWS requires that the GitHub access token has the proper permissions and is uploaded into the appropriate account.

Stages:
  - Name: Source
    RunOrder: 1
    OutputArtifacts:
      - GitHubSource
    ActionTypeId:
      Owner: ThirdParty
      Category: Source
      Provider: GitHub
     Configuration:
       Owner: GitHubAccountName
       Repo: GitHubRepositoryName
       Branch: GitHubBranchName
       PollForSourceChanges: 'false'
       OAuthToken: '{{resolve:secretsmanager:MyGitHubSecret:SecretString:token}}'

PollForSourceChanges must be false for a GitHub Source.

Configuring an access token is outside the scope of this paper. sample access tokens

Build Project

The pipeline's second stage is responsible for building the source action's output artifacts.

The environment:

build env reference docker in codebuild

Artifacts and Outputs:

artifact output

Permissions:

  • service role
  • build project role
  • isolated permissions
  • pipeline reuse

Deploy:

  • Serverless and CodeBuild
  • CodeDeploy
  • CDK Synth Action
  • S3 event to AWS Lambda

Other Considerations

  • pipeline development
  • releasing changes
  • approval stages
  • pipeline notifications
Tags:#AWS