Skip to main content

Git repository

note

CodePipeline supports GitHub, GitLab, and Bitbucket through AWS CodeConnections as Git-based sources. In a real application, you should use these sources. However for simplicity in this lab we will use S3 as the source repository.

This module uses S3 as a source action, and we'll use the git-remote-s3 library to populate that bucket through git in our web IDE.

Our repository will consist of:

  1. A Dockerfile to create a custom UI container image
  2. A Helm chart to deploy the component
  3. A values.yaml file to override the image that is deployed
.
├── chart/
| ├── templates/
| ├── Chart.yaml
│   └── values.yaml
|── values.yaml
└── Dockerfile

The Dockerfile we'll use is intentionally simplified for this lab:

~/environment/eks-workshop/modules/automation/continuousdelivery/codepipeline/repo/Dockerfile
FROM public.ecr.aws/aws-containers/retail-store-sample-ui:0.8.5

# This is an intentionally simplified Dockerfile for simplicity and build speed

The values.yaml file in the root of the repository will only be responsible for configuring the correct container image and tag:

~/environment/eks-workshop/modules/automation/continuousdelivery/codepipeline/repo/values.yaml
image:
repository: $IMAGE_REPOSITORY
tag: $IMAGE_TAG

The IMAGE_URL and IMAGE_REPOSITORY environment variables will be set in our pipeline, as we'll see later.

First let's set up Git:

~$git config --global user.email "you@eksworkshop.com"
~$git config --global user.name "Your Name"

Then copy the various files to a directory we'll use for our Git repository:

~$mkdir -p ~/environment/codepipeline/chart
~$git -C ~/environment/codepipeline init -b main
~$git -C ~/environment/codepipeline remote add \
origin s3+zip://${EKS_CLUSTER_NAME}-${AWS_ACCOUNT_ID}-retail-store-sample-ui/my-repo
~$cp -R ~/environment/eks-workshop/modules/automation/continuousdelivery/codepipeline/repo/* \
~/environment/codepipeline
~$helm pull oci://public.ecr.aws/aws-containers/retail-store-sample-ui-chart:0.8.5 \
-d /tmp
~$tar zxf /tmp/retail-store-sample-ui-chart-0.8.5.tgz \
-C ~/environment/codepipeline/chart --strip-components=1