Skip to content

Commit 2a120e8

Browse files
Test/verify OS PR to Elastic Stack - clearing SSH keys (#1316)
Fix SSH key clearance in buildkite-ami.pkr.hcl Co-authored-by: Patrick Robinson <[email protected]> Co-authored-by: GH user Gezi-lzq
1 parent cb2cc7b commit 2a120e8

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.buildkite/pipeline.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ steps:
102102
name: ":cloudformation: :linux: AMD64 Test"
103103
command:
104104
- git --version
105-
- goss validate --format documentation
105+
- sudo goss validate --format documentation
106106
timeout_in_minutes: 5
107107
agents:
108108
stack: "buildkite-aws-stack-test-linux-amd64-${BUILDKITE_BUILD_NUMBER}"
@@ -145,7 +145,7 @@ steps:
145145
name: ":cloudformation: :linux: ARM64 Test"
146146
command:
147147
- git --version
148-
- goss validate --format documentation
148+
- sudo goss validate --format documentation
149149
timeout_in_minutes: 5
150150
agents:
151151
stack: "buildkite-aws-stack-test-linux-arm64-${BUILDKITE_BUILD_NUMBER}"

.buildkite/steps/launch.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ cat <<EOF >config.json
100100
{
101101
"ParameterKey": "EnableInstanceStorage",
102102
"ParameterValue": "${enable_instance_storage:-false}"
103+
},
104+
{
105+
"ParameterKey": "BuildkiteAdditionalSudoPermissions",
106+
"ParameterValue": "/usr/local/bin/goss"
103107
}
104108
]
105109
EOF

goss.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ file:
1414
/etc/systemd/system/refresh_authorized_keys.timer:
1515
exists: true
1616

17+
/home/ec2-user/.ssh/authorized_keys:
18+
exists: true
19+
contains: ["!packer"]
20+
21+
/root/.ssh/authorized_keys:
22+
exists: true
23+
contains: ["!packer"]
24+
1725
/var/lib/buildkite-agent/builds:
1826
filetype: directory
1927
exists: true

packer/linux/buildkite-ami.pkr.hcl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ source "amazon-ebs" "elastic-ci-stack-ami" {
5656
region = var.region
5757
source_ami = data.amazon-ami.al2023.id
5858
ssh_username = "ec2-user"
59+
ssh_clear_authorized_keys = true
5960
temporary_security_group_source_public_ip = true
6061

6162
run_tags = {
@@ -110,8 +111,4 @@ build {
110111
provisioner "shell" {
111112
script = "scripts/install-buildkite-utils.sh"
112113
}
113-
114-
provisioner "shell" {
115-
inline = ["rm /home/ec2-user/.ssh/authorized_keys"]
116-
}
117114
}

0 commit comments

Comments
 (0)