fix: resolve SSH key and errcheck linter issues

Deploy workflow fixes:
- Add tr -d '\r' to strip carriage returns from SSH key
- Set chmod 700 on .ssh directory for proper permissions
- Suppress ssh-keyscan stderr output

Handler code fixes:
- Check json.Encode() return values in errors.go (2 locations)
- Check json.Encode() return value in health.go
- Add log import to health.go
- Log encoding errors instead of silently ignoring

Resolves:
- "Load key: error in libcrypto" SSH deployment error
- 3 errcheck linter warnings
This commit is contained in:
juanatsap
2025-10-31 12:23:48 +00:00
parent b167378526
commit eb920baace
3 changed files with 15 additions and 6 deletions
+4 -3
View File
@@ -25,9 +25,10 @@ jobs:
# Setup SSH
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy_key
chmod 700 ~/.ssh
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -p $SSH_PORT -H $SSH_HOST >> ~/.ssh/known_hosts
ssh-keyscan -p $SSH_PORT -H $SSH_HOST >> ~/.ssh/known_hosts 2>/dev/null
# Pull latest code and restart service
echo "🔄 Pulling latest code and restarting service..."
@@ -70,7 +71,7 @@ jobs:
echo "🔍 Verifying deployment..."
# Setup SSH for verification
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy_key
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
# Test health endpoint