install ssh-keyscan
This commit is contained in:
+25
-14
@@ -1,30 +1,30 @@
|
||||
name: 'Checkout and Config Injection'
|
||||
description: 'Clones the project via SSH and injects configs from a separate repo'
|
||||
name: "Checkout and Config Injection"
|
||||
description: "Clones the project via SSH and injects configs from a separate repo"
|
||||
inputs:
|
||||
ssh_key:
|
||||
description: 'SSH Private Key'
|
||||
description: "SSH Private Key"
|
||||
required: true
|
||||
config_repo:
|
||||
description: 'Configuration Repository Path (e.g., dev-ops/configs.git)'
|
||||
description: "Configuration Repository Path (e.g., dev-ops/configs.git)"
|
||||
required: false
|
||||
default: ''
|
||||
default: ""
|
||||
config_repo_branch:
|
||||
description: 'Configuration Repository Branch'
|
||||
description: "Configuration Repository Branch"
|
||||
required: false
|
||||
default: 'main'
|
||||
default: "main"
|
||||
app_key:
|
||||
description: 'Application Key in the config repo'
|
||||
description: "Application Key in the config repo"
|
||||
required: true
|
||||
gitea_host:
|
||||
description: 'Gitea Hostname'
|
||||
description: "Gitea Hostname"
|
||||
required: false
|
||||
default: 'gitea.hclife.co'
|
||||
default: "gitea.hclife.co"
|
||||
gitea_port:
|
||||
description: 'Gitea SSH Port'
|
||||
description: "Gitea SSH Port"
|
||||
required: false
|
||||
default: '2222'
|
||||
default: "2222"
|
||||
runs:
|
||||
using: 'composite'
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Checkout and Config
|
||||
shell: bash
|
||||
@@ -43,8 +43,19 @@ runs:
|
||||
|
||||
echo "$SSH_KEY" > "$SSH_TMP_DIR/id_rsa"
|
||||
chmod 600 "$SSH_TMP_DIR/id_rsa"
|
||||
ssh-keyscan -p "$GITEA_PORT" "$GITEA_HOST" > "$SSH_TMP_DIR/known_hosts"
|
||||
|
||||
# Ensure ssh-keyscan is available for strict host key checking
|
||||
if ! command -v ssh-keyscan &> /dev/null; then
|
||||
echo "ssh-keyscan not found, attempting to install..."
|
||||
if command -v apk &> /dev/null; then
|
||||
apk add --no-cache openssh-client
|
||||
elif command -v apt-get &> /dev/null; then
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update && apt-get install -y openssh-client
|
||||
fi
|
||||
fi
|
||||
|
||||
ssh-keyscan -p "$GITEA_PORT" "$GITEA_HOST" > "$SSH_TMP_DIR/known_hosts"
|
||||
export GIT_SSH_COMMAND="ssh -i $SSH_TMP_DIR/id_rsa -o UserKnownHostsFile=$SSH_TMP_DIR/known_hosts -o StrictHostKeyChecking=yes"
|
||||
|
||||
echo "Initializing project repository..."
|
||||
|
||||
Reference in New Issue
Block a user