Skip to content

Commit 0a9ddd9

Browse files
committed
Merge branches 'keithduncan/update-agent', 'keithduncan/update-s3secrets-hook' and 'keithduncan/use-pre-built-binaries'
3 parents 562f0ac + 4e15bb1 + 507bd66 commit 0a9ddd9

File tree

10 files changed

+37
-89
lines changed

10 files changed

+37
-89
lines changed

.buildkite/pipeline.yml

Lines changed: 0 additions & 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"

.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")

Makefile

Lines changed: 3 additions & 12 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 \
@@ -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 && GOOS=windows GOARCH=amd64 go build -o ../../../$@

packer/linux/buildkite-ami.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737
"source": "../../plugins",
3838
"destination": "/tmp/plugins"
3939
},
40-
{
41-
"type": "file",
42-
"source": "../../build/s3secrets-helper-linux-{{user `goarch`}}",
43-
"destination": "/tmp/s3secrets-helper"
44-
},
4540
{
4641
"type": "shell",
4742
"script": "scripts/install-utils.sh"
@@ -62,6 +57,10 @@
6257
"type": "shell",
6358
"script": "scripts/install-buildkite-agent.sh"
6459
},
60+
{
61+
"type": "shell",
62+
"script": "scripts/install-s3secrets-helper.sh"
63+
},
6564
{
6665
"type": "shell",
6766
"script": "scripts/install-git-lfs.sh"

packer/linux/scripts/install-buildkite-agent.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,3 @@ echo "Copying built-in plugins..."
7474
sudo mkdir -p /usr/local/buildkite-aws-stack/plugins
7575
sudo cp -a /tmp/plugins/* /usr/local/buildkite-aws-stack/plugins/
7676
sudo chown -R buildkite-agent: /usr/local/buildkite-aws-stack
77-
sudo install --mode=0755 /tmp/s3secrets-helper /usr/local/bin/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -eu -o pipefail
3+
4+
S3_SECRETS_HELPER_VERSION=2.1.2
5+
6+
MACHINE="$(uname -m)"
7+
8+
case "${MACHINE}" in
9+
x86_64) ARCH=amd64;;
10+
aarch64) ARCH=arm64;;
11+
esac
12+
13+
echo "Downloading s3-secrets-helper..."
14+
sudo curl -Lsf -o /usr/local/bin/s3secrets-helper \
15+
"https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks/releases/download/v${S3_SECRETS_HELPER_VERSION}/s3secrets-helper-linux-${ARCH}"
16+
sudo chmod +x /usr/local/bin/s3secrets-helper

packer/windows/buildkite-ami.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
"source": "../../plugins",
3737
"destination": "C:/packer-temp"
3838
},
39-
{
40-
"type": "file",
41-
"source": "../../build/s3secrets-helper-windows-amd64.exe",
42-
"destination": "C:/packer-temp/s3secrets-helper.exe"
43-
},
4439
{
4540
"type": "powershell",
4641
"script": "scripts/install-utils.ps1"
@@ -61,6 +56,10 @@
6156
"type": "powershell",
6257
"script": "scripts/install-buildkite-agent.ps1"
6358
},
59+
{
60+
"type": "powershell",
61+
"script": "scripts/install-s3secrets-helper.ps1"
62+
},
6463
{
6564
"type": "powershell",
6665
"script": "scripts/install-session-manager-plugin.ps1"

packer/windows/scripts/install-buildkite-agent.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ Copy-Item -Path C:\packer-temp\conf\buildkite-agent\scripts\stop-agent-gracefull
4545
Write-Output "Copying built-in plugins..."
4646
New-Item -ItemType directory -Path "C:\Program Files\Git\usr\local\buildkite-aws-stack\plugins"
4747
Copy-Item -Recurse -Path C:\packer-temp\plugins\* -Destination "C:\Program Files\Git\usr\local\buildkite-aws-stack\plugins\"
48-
Copy-Item -Path C:\packer-temp\s3secrets-helper.exe -Destination C:\buildkite-agent\bin
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Stop script execution when a non-terminating error occurs
2+
$ErrorActionPreference = "Stop"
3+
4+
$S3_SECRETS_HELPER_VERSION = "2.1.2"
5+
6+
Write-Output "Downloading s3-secrets-helper v${S3_SECRETS_HELPER_VERSION}..."
7+
Invoke-WebRequest -OutFile C:\buildkite-agent\bin\s3secrets-helper.exe -Uri "https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks/releases/download/v${S3_SECRETS_HELPER_VERSION}/s3secrets-helper-windows-amd64"
8+
s3secrets-helper.exe
9+
If ($lastexitcode -ne 0) { Exit $lastexitcode }

0 commit comments

Comments
 (0)