-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add infra code for release pipeline
Use CDK to create a pipeline stack that uses a GitHub webhook and CodeBuild to publish docker images for amd64 and arm64 architectures to DockerHub. TODO: Also publish to ECR Public
- Loading branch information
Showing
8 changed files
with
2,388 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,7 @@ out/ | |
.idea | ||
.idea/* | ||
.DS_Store | ||
|
||
infra/node_modules | ||
infra/*.js | ||
infra/*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Continuous delivery pipelines | ||
|
||
This package uses the [AWS Cloud Development Kit (AWS)](https://github.com/awslabs/aws-cdk) to model AWS CodePipeline pipelines and to provision them with AWS CloudFormation. | ||
|
||
* pipeline.ts: Builds and publishes the base Docker image for the backend API service | ||
|
||
This creates as CodePipeline pipeline which consists of a souce stage that usees a GitHub webhook and a build stage that uses AWS CodeBuild to build and publish Docker images to DockerHub. | ||
|
||
## GitHub Access Token | ||
The official pipeilne uses a team account (ecs-local-container-endpoints+release@amazon.com). | ||
|
||
Create a GitHub [personal access token](https://github.com/settings/tokens) with access to your fork of the repo, including "admin:repo_hook" and "repo" permissions. Then store the token in Secrets Manager: | ||
|
||
``` | ||
aws secretsmanager create-secret --region us-west-2 --name EcsDevXGitHubToken --secret-string <my-github-personal-access-token> | ||
``` | ||
|
||
## Deploy | ||
|
||
To deploy this pipeline, install the AWS CDK CLI: `npm i -g aws-cdk` | ||
|
||
Install and build everything: `npm install && npm run build` | ||
|
||
Then deploy the pipeline stacks: | ||
|
||
``` | ||
cdk deploy --app 'node pipeline.js' | ||
``` | ||
|
||
See the pipelines in the CodePipeline console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 0.2 | ||
|
||
env: | ||
secrets-manager: | ||
USERNAME: "com.amazonaws.ec2.madison.dockerhub.amazon-ecs-local-container-endpoints.credentials:username" | ||
PASSWORD: "com.amazonaws.ec2.madison.dockerhub.amazon-ecs-local-container-endpoints.credentials:password" | ||
|
||
phases: | ||
pre_build: | ||
commands: | ||
- echo "Building Image for Amazon ECS Local Container Endpoints..." | ||
- docker login -u ${USERNAME} --password ${PASSWORD} | ||
build: | ||
commands: | ||
- make publish |
Oops, something went wrong.