Skip to content

Commit 62c209b

Browse files
authored
Merge branch 'master' into MaxInstanceLifetime
2 parents 155478b + f8ce90f commit 62c209b

35 files changed

+607
-654
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -16,63 +16,6 @@ steps:
1616
run: unit-tests
1717
config: docker-compose.unit-tests.yml
1818

19-
- id: "s3secrets-helper-linux-amd64"
20-
name: ":golang: :linux: s3secrets-helper-linux-amd64"
21-
agents:
22-
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE}"
23-
plugins:
24-
docker#v3.7.0:
25-
image: "golang:1.15"
26-
mount-checkout: false
27-
volumes:
28-
- "./build:/build:rw"
29-
- "./plugins/secrets/s3secrets-helper:/s3secrets-helper:ro"
30-
workdir: /s3secrets-helper
31-
environment:
32-
- "GOOS=linux"
33-
- "GOARCH=amd64"
34-
command: ["go", "build", "-o", "/build/s3secrets-helper-linux-amd64"]
35-
artifact_paths:
36-
- build/s3secrets-helper-linux-amd64
37-
38-
- id: "s3secrets-helper-linux-arm64"
39-
name: ":golang: :linux: s3secrets-helper-linux-arm64"
40-
agents:
41-
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE}"
42-
plugins:
43-
docker#v3.7.0:
44-
image: "golang:1.15"
45-
mount-checkout: false
46-
volumes:
47-
- "./build:/build:rw"
48-
- "./plugins/secrets/s3secrets-helper:/s3secrets-helper:ro"
49-
workdir: /s3secrets-helper
50-
environment:
51-
- "GOOS=linux"
52-
- "GOARCH=arm64"
53-
command: ["go", "build", "-o", "/build/s3secrets-helper-linux-arm64"]
54-
artifact_paths:
55-
- build/s3secrets-helper-linux-arm64
56-
57-
- id: "s3secrets-helper-windows-amd64"
58-
name: ":golang: :windows: s3secrets-helper-windows-amd64.exe"
59-
agents:
60-
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE}"
61-
plugins:
62-
docker#v3.7.0:
63-
image: "golang:1.15"
64-
mount-checkout: false
65-
volumes:
66-
- "./build:/build:rw"
67-
- "./plugins/secrets/s3secrets-helper:/s3secrets-helper:ro"
68-
workdir: /s3secrets-helper
69-
environment:
70-
- "GOOS=windows"
71-
- "GOARCH=amd64"
72-
command: ["go", "build", "-o", "/build/s3secrets-helper-windows-amd64.exe"]
73-
artifact_paths:
74-
- build/s3secrets-helper-windows-amd64.exe
75-
7619
- id: "packer-windows"
7720
name: ":packer: :windows:"
7821
command: .buildkite/steps/packer.sh windows
@@ -83,7 +26,6 @@ steps:
8326
depends_on:
8427
- "lint"
8528
- "bats-tests"
86-
- "s3secrets-helper-windows-amd64"
8729

8830
- id: "launch-windows"
8931
name: ":cloudformation: :windows: Launch"
@@ -112,7 +54,6 @@ steps:
11254
depends_on:
11355
- "lint"
11456
- "bats-tests"
115-
- "s3secrets-helper-linux-amd64"
11657

11758
- id: "launch-linux-amd64"
11859
name: ":cloudformation: :linux: AMD64 Launch"
@@ -141,7 +82,6 @@ steps:
14182
depends_on:
14283
- "lint"
14384
- "bats-tests"
144-
- "s3secrets-helper-linux-arm64"
14585

14686
- id: "launch-linux-arm64"
14787
name: ":cloudformation: :linux: ARM64 Launch"
@@ -178,6 +118,7 @@ steps:
178118
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE}"
179119
concurrency_group: "aws-stack-publish"
180120
concurrency: 1
121+
concurrency_method: eager
181122
artifact_paths: "build/*.yml"
182123
depends_on: "copy-ami"
183124

.buildkite/steps/cleanup.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ aws s3api list-buckets \
4848
| grep -E 'buildkite-aws-stack-test-.*-managedsecretsbucket' \
4949
| xargs -n1 -t -I% aws s3 rb s3://% --force
5050

51+
# Do this before deleting the stacks so we don't race with stack-managed log
52+
# groups
53+
echo "--- Deleting old lambda logs after ${cutoff_date_milli}"
54+
aws logs describe-log-groups \
55+
--log-group-name-prefix "/aws/lambda/buildkite-aws-stack-test-" \
56+
--query "$(printf 'logGroups[?creationTime<`%s`].[logGroupName]' "$cutoff_date_milli" )" \
57+
--output text \
58+
| xargs -n1 -t -I% aws logs delete-log-group --log-group-name "%"
59+
5160
echo "--- Deleting old cloudformation stacks"
5261
aws cloudformation describe-stacks \
5362
--output text \
@@ -62,10 +71,3 @@ aws ec2 describe-instances \
6271
--query "$(printf 'Reservations[].Instances[?LaunchTime<`%s`].[InstanceId]' "$cutoff_date")" \
6372
--output text \
6473
| xargs -n1 -t -I% aws ec2 terminate-instances --instance-ids "%"
65-
66-
echo "--- Deleting old lambda logs after ${cutoff_date_milli}"
67-
aws logs describe-log-groups \
68-
--log-group-name-prefix "/aws/lambda/buildkite-aws-stack-test-" \
69-
--query "$(printf 'logGroups[?creationTime<`%s`].[logGroupName]' "$cutoff_date_milli" )" \
70-
--output text \
71-
| xargs -n1 -t -I% aws logs delete-log-group --log-group-name "%"

.buildkite/steps/packer.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,13 @@ fi
99
os="${1:-linux}"
1010
arch="${2:-amd64}"
1111
agent_binary="buildkite-agent-${os}-${arch}"
12-
s3secrets_binary="s3secrets-helper-${os}-${arch}"
1312

1413
if [[ "$os" == "windows" ]] ; then
1514
agent_binary+=".exe"
16-
s3secrets_binary+=".exe"
1715
fi
1816

1917
mkdir -p "build/"
2018

21-
buildkite-agent artifact download "build/$s3secrets_binary" .
22-
2319
# Build a hash of packer files and the agent versions
2420
packer_files_sha=$(find Makefile "packer/${os}" plugins/ -type f -print0 | xargs -0 sha1sum | awk '{print $1}' | sort | sha1sum | awk '{print $1}')
2521
stable_agent_sha=$(curl -Lfs "https://download.buildkite.com/agent/stable/latest/${agent_binary}.sha256")

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
[submodule "plugins/secrets"]
22
path = plugins/secrets
33
url = https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks.git
4+
branch = v2.1.4
45

56
[submodule "plugins/ecr"]
67
path = plugins/ecr
78
url = https://github.com/buildkite-plugins/ecr-buildkite-plugin.git
9+
branch = v2.4.0
810

911
[submodule "plugins/docker-login"]
1012
path = plugins/docker-login
1113
url = https://github.com/buildkite-plugins/docker-login-buildkite-plugin.git
14+
branch = v2.0.2

CHANGELOG.md

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,87 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [v5.6.1](https://github.com/buildkite/elastic-ci-stack-for-aws/compare/v5.6.0...v5.6.1) (2021-09-02)
8+
9+
## Fixed
10+
11+
* Missed parameter `BuildkiteAgentTokenParameterStoreKMSKey` in `Autoscaling` nested cloudformation template [#901](https://github.com/buildkite/elastic-ci-stack-for-aws/issues/901)
12+
13+
## [v5.6.0](https://github.com/buildkite/elastic-ci-stack-for-aws/compare/v5.5.1...v5.6.0) (2021-08-31)
14+
15+
### Added
16+
17+
* Cross-region secrets bucket support to git-credentials-s3-secrets [elastic-ci-stack-s3-secrets-hooks#48](https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks/pull/48)
18+
* AssumeRole support in the ECR Login plug-in [ecr-buildkite-plugin#69](https://github.com/buildkite-plugins/ecr-buildkite-plugin/pull/69)
19+
20+
### Changed
21+
22+
* Instance IAM Profile role permissions to be more tightly scoped [#800](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/800) ([@nitrocode](https://github.com/nitrocode))
23+
* Import buildkite-lambda-scaler from the Severless Application Repository [#685](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/685)
24+
* The built-in environment hook no longer overwrites `AWS_REGION` and `AWS_DEFAULT_REGION` if already present [#892](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/892) ([@toothbrush](https://github.com/toothbrush))
25+
* Included buildkite-agent from 3.32.1 to 3.32.3
26+
27+
### Fixed
28+
29+
* Hourly disk check script on Linux [#898](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/898)
30+
* git-credentials-s3-secrets on Windows [elastic-ci-stack-s3-secrets-hooks#47](https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks/pull/47)
31+
* PowerShell hook support on Windows [agent#1497](https://github.com/buildkite/agent/pull/1497)
32+
33+
## [v5.5.1](https://github.com/buildkite/elastic-ci-stack-for-aws/compare/v5.5.0...v5.5.1) (2021-08-06)
34+
35+
### Changed
36+
37+
* Included buildkite-agent from 3.32.0 to 3.32.1
38+
39+
### Fixed
40+
41+
* A source of unexpected instance termination causing build failures [#888](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/888)
42+
43+
## [v5.5.0](https://github.com/buildkite/elastic-ci-stack-for-aws/compare/v5.4.0...v5.5.0) (2021-07-30)
44+
45+
### Added
46+
47+
* Template validation rules for the Buildkite Agent token [#873](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/873)
48+
* Secret redaction in build logs [agent#1452](https://github.com/buildkite/agent/pull/1452)
49+
* Support for the `pre-bootstrap` Buildkite Agent Lifecycle Hook [agent#1456](https://github.com/buildkite/agent/pull/1456)
50+
51+
### Changed
52+
53+
* Included buildkite-agent from 3.30.0 to 3.32.0 [#876](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/876) ([keithduncan](https://github.com/keithduncan))
54+
55+
### Fixed
56+
57+
* Remove logging of the Buildkite Agent token to CloudWatch Logs [#879](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/879)
58+
* Cross-region S3 bucket access for secrets [#875](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/875)
59+
* An error when handling zero length `environment` files [elastic-ci-stack-s3-secrets-hooks#42](https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks/pull/42)
60+
* A hang when loading ssh keys without a trailing newline [elastic-ci-stack-s3-secrets-hooks#44](https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks/pull/44)
61+
62+
## [v5.4.0](https://github.com/buildkite/elastic-ci-stack-for-aws/compare/v5.3.2...v5.4.0) (2021-06-30)
63+
64+
### Added
65+
66+
* Docker Buildx [#871](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/871)
67+
* Docs on which user SSH access applies to [#863](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/863) ([@Temikus](https://github.com/Temikus))
68+
69+
### Changed
70+
71+
* Update Buildkite Agent to version 3.30.0 [#868](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/868) ([@esalter](https://github.com/esalter))
72+
* The HttpPutResponseHopLimit from 1 to 2 [#858](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/858)
73+
74+
### Fixed
75+
76+
* The default cost allocation tag value [#859](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/859)
77+
78+
## [v5.3.2](https://github.com/buildkite/elastic-ci-stack-for-aws/compare/v5.3.1...v5.3.2) (2021-06-11)
79+
80+
### Fixed
81+
* Fix s3secrets-helper for Windows [#846](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/846) ([DuBistKomisch](https://github.com/DuBistKomisch))
82+
* Pin Docker systemd configuration to the same Docker version [#849](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/849) ([cmanou](https://github.com/cmanou))
83+
* Excessive instance scaling while waiting for instances to boot
84+
85+
### Changed
86+
* Create S3 secrets bucket only when needed [#844](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/844) ([vgrigoruk](https://github.com/vgrigoruk))
87+
788
## [v5.3.1](https://github.com/buildkite/elastic-ci-stack-for-aws/compare/v5.3.0...v5.3.1) (2021-05-05)
889

990
### Fixed
@@ -109,7 +190,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
109190

110191
### Dependencies updated
111192
* Bump Buildkite Agent to v3.25.0 [#749](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/749) ([JuanitoFatas](https://github.com/JuanitoFatas))
112-
* Bump Buildkite Agent Scaler to v1.0.2 [#724](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/724) ([JuanitoFatas](https://github.com/JuanitoFatas)) [4fafd8e](https://github.com/buildkite/elastic-ci-stack-for-aws/commit/4fafd8e85a888f0d7b23bb3a1420332fe4e9063c) ([JuanitoFatas](https://github.com/JuanitoFatas))
193+
* Bump Buildkite Agent Scaler to v1.0.2 [#724](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/724) ([JuanitoFatas](https://github.com/JuanitoFatas)) [4fafd8e](https://github.com/buildkite/elastic-ci-stack-for-aws/commit/4fafd8e85a888f0d7b23bb3a1420332fe4e9063c) ([JuanitoFatas](https://github.com/JuanitoFatas))
113194
* Bump docker to v19.03.13 (linux) and v19.03.12 (windows) and docker-compose to v1.27.4 (linux, windows uses [latest choco version](https://chocolatey.org/packages/docker-comp…)) [#719](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/719) ([yob](https://github.com/yob)) [#723](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/723) ([JuanitoFatas](https://github.com/JuanitoFatas))
114195
* Bump bundled plugins to the latest versions [secrets](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/740) [ecr](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/741) [docker login](https://github.com/buildkite/elastic-ci-stack-for-aws/pull/744)
115196

Makefile

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ build/linux-amd64-ami.txt: packer-linux-amd64.output env-AWS_REGION
7575
grep -Eo "$(AWS_REGION): (ami-.+)" $< | cut -d' ' -f2 | xargs echo -n > $@
7676

7777
# Build linux packer image
78-
packer-linux-amd64.output: $(PACKER_LINUX_FILES) build/s3secrets-helper-linux-amd64
78+
packer-linux-amd64.output: $(PACKER_LINUX_FILES)
7979
docker run \
8080
-e AWS_DEFAULT_REGION \
8181
-e AWS_PROFILE \
@@ -96,7 +96,7 @@ build/linux-arm64-ami.txt: packer-linux-arm64.output env-AWS_REGION
9696
grep -Eo "$(AWS_REGION): (ami-.+)" $< | cut -d' ' -f2 | xargs echo -n > $@
9797

9898
# Build linuxarm64 packer image
99-
packer-linux-arm64.output: $(PACKER_LINUX_FILES) build/s3secrets-helper-linux-arm64
99+
packer-linux-arm64.output: $(PACKER_LINUX_FILES)
100100
docker run \
101101
-e AWS_DEFAULT_REGION \
102102
-e AWS_PROFILE \
@@ -117,7 +117,7 @@ build/windows-amd64-ami.txt: packer-windows-amd64.output env-AWS_REGION
117117
grep -Eo "$(AWS_REGION): (ami-.+)" $< | cut -d' ' -f2 | xargs echo -n > $@
118118

119119
# Build windows packer image
120-
packer-windows-amd64.output: $(PACKER_WINDOWS_FILES) build/s3secrets-helper-windows-amd64.exe
120+
packer-windows-amd64.output: $(PACKER_WINDOWS_FILES)
121121
docker run \
122122
-e AWS_DEFAULT_REGION \
123123
-e AWS_PROFILE \
@@ -146,15 +146,15 @@ create-stack: build/aws-stack.yml env-STACK_NAME
146146
--stack-name $(STACK_NAME) \
147147
--disable-rollback \
148148
--template-body "file://$(PWD)/build/aws-stack.yml" \
149-
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
149+
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
150150
--parameters "$$(cat config.json)"
151151

152152
update-stack: build/aws-stack.yml env-STACK_NAME
153153
aws cloudformation update-stack \
154154
--output text \
155155
--stack-name $(STACK_NAME) \
156156
--template-body "file://$(PWD)/build/aws-stack.yml" \
157-
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
157+
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
158158
--parameters "$$(cat config.json)"
159159

160160

@@ -179,12 +179,3 @@ validate: build/aws-stack.yml
179179
generate-toc:
180180
docker run -it --rm -v "$(PWD):/app" node:slim bash \
181181
-c "npm install -g markdown-toc && cd /app && markdown-toc -i README.md"
182-
183-
build/s3secrets-helper-linux-amd64:
184-
cd plugins/secrets/s3secrets-helper && GOOS=linux GOARCH=amd64 go build -o ../../../$@
185-
186-
build/s3secrets-helper-linux-arm64:
187-
cd plugins/secrets/s3secrets-helper && GOOS=linux GOARCH=arm64 go build -o ../../../$@
188-
189-
build/s3secrets-helper-windows-amd64.exe:
190-
cd plugins/secrets/s3secrets-helper && GOOD=windows GOARCH=amd64 go build -o ../../../$@

0 commit comments

Comments
 (0)