Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.96 KB

File metadata and controls

52 lines (37 loc) · 1.96 KB

CodePipeline / CodeBuild / CodeCommit git metadata example

License: MIT

This project illustrates how to get git metadata into CodePipeline by cloning the repository and winding it back to the right commit. It is the companion code to this blog post, which explains the strategy in detail.

You can deploy it with a command like this:

aws cloudformation deploy --template-file cfn-pipeline.yaml \
    --stack-name=<YOUR_STACK_NAME>                          \
    --parameter-overrides                                   \
      RepositoryName=<YOUR_REPO_NAME>                       \
      RepositoryCloneUrl=<YOUR_REPO_CLONE_URL>              \
      RepositoryBranch=<OPTIONAL_YOUR_REPO_BRANCH>          \
      --capabilities CAPABILITY_IAM

Make sure to replace the bracketed values before deployment.

Full instructions

To see this in action, follow the following steps:

  1. Clone this repository.
git clone https://github.com/TimothyJones/codepipeline-git-metadata-example.git
  1. Create an AWS CodeCommit repository, note down the repository name and the clone URL.

  2. Add your new CodeCommit repo as a remote, and push:

git remote add aws <YOUR CLONE URL>
git push -u aws master

3b) If the above push fails, you will probably need to configure the AWS credential helper

  1. Deploy the pipeline:
aws cloudformation deploy --template-file cfn-pipeline.yaml \
    --stack-name=<ANY_NEW_STACK_NAME>                       \
    --parameter-overrides                                   \
      RepositoryName=<YOUR_REPO_NAME>                       \
      RepositoryCloneUrl=<YOUR_REPO_CLONE_URL>              \
      --capabilities CAPABILITY_IAM