enhancement(k8s-bootstrap): fail CI key removal when the key is not found
Deploy k8s Bootstrap / Bootstrap k3s Cluster (pull_request) Skipped
Deploy k8s Bootstrap / Pulumi Preview (pull_request) Successful in 33s
Secret Scan / Betterleaks (pull_request) Successful in 5s

The final check only verified that the key was absent afterwards, which
also passes when the key was never matched, e.g. a hand-added key with a
comment. Requiring the key beforehand makes that case fail visibly.
This commit is contained in:
kasun committed 2026-12-06 02:52:11 +01:00
1 parent 3c07c5d3b3
commit 3b37e3451b
1 file changed
+1
+1
View File
@@ -472,6 +472,7 @@ const revokeCiKeyScript = `set -euo pipefail
IFS= read -r KEY || true
[ -n "$KEY" ]
f="$HOME/.ssh/authorized_keys"
grep -qxF -- "$KEY" "$f"
grep -vxF -- "$KEY" "$f" > "$f.new" || [ $? -eq 1 ]
[ -s "$f.new" ]
chmod 600 "$f.new"