enhancement(k8s-bootstrap): fail CI key removal when the key is not found
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:
1 parent
3c07c5d3b3
commit
3b37e3451b
1 file changed
+1
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user