fix: repair SSH key step quoting in workflows
All checks were successful
Terraform Plan / Terraform Plan (push) Successful in 17s
All checks were successful
Terraform Plan / Terraform Plan (push) Successful in 17s
This commit is contained in:
@@ -53,7 +53,12 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KEY_CONTENT="$KEY_CONTENT" python3 -c 'import os, pathlib; key=os.environ.get("KEY_CONTENT", "").replace("\r", "").strip(); key=key[1:-1] if len(key) > 2 and ((key[0] == "\"" and key[-1] == "\"") or (key[0] == "\'" and key[-1] == "\'")) else key; key=key.replace("\\n", "\n") if "\\n" in key and "\n" not in key else key; pathlib.Path.home().joinpath(".ssh", "id_ed25519").write_text(key if key.endswith("\n") else key + "\n")'
|
KEY_CONTENT="$(printf '%s' "$KEY_CONTENT" | tr -d '\r')"
|
||||||
|
if printf '%s' "$KEY_CONTENT" | grep -q '\\n'; then
|
||||||
|
printf '%b' "$KEY_CONTENT" > ~/.ssh/id_ed25519
|
||||||
|
else
|
||||||
|
printf '%s\n' "$KEY_CONTENT" > ~/.ssh/id_ed25519
|
||||||
|
fi
|
||||||
chmod 0600 ~/.ssh/id_ed25519
|
chmod 0600 ~/.ssh/id_ed25519
|
||||||
|
|
||||||
if ! ssh-keygen -y -f ~/.ssh/id_ed25519 >/dev/null 2>&1; then
|
if ! ssh-keygen -y -f ~/.ssh/id_ed25519 >/dev/null 2>&1; then
|
||||||
|
|||||||
@@ -53,7 +53,12 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KEY_CONTENT="$KEY_CONTENT" python3 -c 'import os, pathlib; key=os.environ.get("KEY_CONTENT", "").replace("\r", "").strip(); key=key[1:-1] if len(key) > 2 and ((key[0] == "\"" and key[-1] == "\"") or (key[0] == "\'" and key[-1] == "\'")) else key; key=key.replace("\\n", "\n") if "\\n" in key and "\n" not in key else key; pathlib.Path.home().joinpath(".ssh", "id_ed25519").write_text(key if key.endswith("\n") else key + "\n")'
|
KEY_CONTENT="$(printf '%s' "$KEY_CONTENT" | tr -d '\r')"
|
||||||
|
if printf '%s' "$KEY_CONTENT" | grep -q '\\n'; then
|
||||||
|
printf '%b' "$KEY_CONTENT" > ~/.ssh/id_ed25519
|
||||||
|
else
|
||||||
|
printf '%s\n' "$KEY_CONTENT" > ~/.ssh/id_ed25519
|
||||||
|
fi
|
||||||
chmod 0600 ~/.ssh/id_ed25519
|
chmod 0600 ~/.ssh/id_ed25519
|
||||||
|
|
||||||
if ! ssh-keygen -y -f ~/.ssh/id_ed25519 >/dev/null 2>&1; then
|
if ! ssh-keygen -y -f ~/.ssh/id_ed25519 >/dev/null 2>&1; then
|
||||||
|
|||||||
@@ -96,7 +96,12 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KEY_CONTENT="$KEY_CONTENT" python3 -c 'import os, pathlib; key=os.environ.get("KEY_CONTENT", "").replace("\r", "").strip(); key=key[1:-1] if len(key) > 2 and ((key[0] == "\"" and key[-1] == "\"") or (key[0] == "\'" and key[-1] == "\'")) else key; key=key.replace("\\n", "\n") if "\\n" in key and "\n" not in key else key; pathlib.Path.home().joinpath(".ssh", "id_ed25519").write_text(key if key.endswith("\n") else key + "\n")'
|
KEY_CONTENT="$(printf '%s' "$KEY_CONTENT" | tr -d '\r')"
|
||||||
|
if printf '%s' "$KEY_CONTENT" | grep -q '\\n'; then
|
||||||
|
printf '%b' "$KEY_CONTENT" > ~/.ssh/id_ed25519
|
||||||
|
else
|
||||||
|
printf '%s\n' "$KEY_CONTENT" > ~/.ssh/id_ed25519
|
||||||
|
fi
|
||||||
chmod 0600 ~/.ssh/id_ed25519
|
chmod 0600 ~/.ssh/id_ed25519
|
||||||
|
|
||||||
if ! ssh-keygen -y -f ~/.ssh/id_ed25519 >/dev/null 2>&1; then
|
if ! ssh-keygen -y -f ~/.ssh/id_ed25519 >/dev/null 2>&1; then
|
||||||
|
|||||||
Reference in New Issue
Block a user