Skip to content

Commit 116c5e5

Browse files
committed
Docs: Add integration docs and some developer docs
Signed-off-by: John McBride <[email protected]>
1 parent 9ecdd66 commit 116c5e5

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,20 @@ Note: We do not recommend using the Bottlerocket ECS Updater in conjunction with
163163
The ECS Updater is designed to keep services safe from interruption by updating one instance at a time.
164164
With the short average lifetime of Spot instances, the updater may not update them until relatively late in their life, meaning they may not be up to date when serving your application.
165165

166+
## Developer guide
167+
168+
To get started with building and developing the ECS updater, make sure you have:
169+
170+
* [Go installed](https://go.dev/doc/install)
171+
* [`golangci-lint` installed locally](https://golangci-lint.run/usage/install/#local-installation)
172+
* make
173+
* [amazon-ecr-credential-helper](https://github.com/awslabs/amazon-ecr-credential-helper) setup for Docker and access to ECR (or your preferred image registry)
174+
* And the [cloud formation template linter installed](https://github.com/aws-cloudformation/cfn-lint)
175+
176+
Make sure everything is ready and installed by running the tests with `make test`.
177+
Ensure the local builds work by running `make`.
178+
You might first need to get the modules downloaded to your local go mod cache by running `make tidy`.
179+
166180
## Security
167181

168182
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.

integ/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Integration tests
2+
3+
The following integration workflow is how you can
4+
test your changes and verifying that new dependencies didn’t break the updater mechanisms.
5+
It’s also similar to how we verify versions of the ECS Updater,
6+
so it’s useful to go through it when making changes
7+
and should in total take less than 1 hour.
8+
9+
1. You’ll want to set up a test ECS cluster.
10+
11+
Thankfully, this is really easy with the existing integration tests setup script:
12+
https://github.com/bottlerocket-os/bottlerocket-ecs-updater/blob/develop/integ/setup.sh
13+
14+
```sh
15+
./setup.sh --ami-id ami-05d2e4a6b8399095a
16+
```
17+
18+
This script expects the ami-id of a Bottlerocket ECS variant.
19+
This will setup an ECS cluster using the integration CloudFormation stack
20+
and using that Bottlerocket ECS variant as EC2 compute.
21+
22+
2. Build an ECS updater image from your changes:
23+
24+
```
25+
# Build the image and tag it as "latest"
26+
make image
27+
28+
# Verify the image was built and tagged a moment ago
29+
docker images | head -n 10
30+
31+
# Re-tag the image to wherever you want to land it on your ECR registry
32+
docker tag bottlerocket-ecs-updater:latest \
33+
<account-id>.dkr.ecr.us-west-2.amazonaws.com/bottlerocket-ecs-updater:my-test
34+
35+
# Push it to your ECR registry
36+
docker push \
37+
<account-id>.dkr.ecr.us-west-2.amazonaws.com/bottlerocket-ecs-updater:my-test
38+
```
39+
40+
3. Once your integration ECS cluster is up and you’ve built/pushed a new image,
41+
you can execute the run-updater script to actually do the integration tests!
42+
43+
Note that you need to provide the image URL of the new image you just built.
44+
This is the actual image that gets deployed as a fargate task!
45+
46+
```
47+
./run-updater.sh \
48+
--cluster ecs-updater-integ-cluster \
49+
--updater-image <account-id>.dkr.ecr.us-west-2.amazonaws.com/bottlerocket-ecs-updater:my-test
50+
```
51+
52+
4. Cleanup is also easy! There’s a script for that as well:
53+
54+
```
55+
./cleanup.sh --cluster ecs-updater-integ-cluster
56+
```
57+
58+
This tears down the ECS cluster by name releasing any artifacts from the integration tests.
59+
60+
In all, the total process takes well under an hour. ECS clusters spin up and down very quickly.

0 commit comments

Comments
 (0)