fixing ssh
Some checks failed
Test Actions (self-test) / Build tiny multi-arch image (push) Successful in 9s
Test Actions (self-test) / Test Kubernetes actions (push) Failing after 16s
Test Actions (self-test) / Test SSH deploy action (push) Successful in 19s

This commit is contained in:
2026-07-13 21:04:12 -03:00
parent e8eb378541
commit cc5d2088bd

View File

@@ -106,24 +106,27 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y openssh-server
# Ensure privilege separation directory exists
sudo mkdir -p /run/sshd
# Generate host keys if missing
sudo ssh-keygen -A
# Start sshd on a custom port 2222 to avoid port conflicts on the runner host
sudo /usr/sbin/sshd -p 2222 -o "ListenAddress 127.0.0.1" -o "UsePAM yes"
# Configure passwordless SSH login for current user
mkdir -p ~/.ssh
ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_test
cat ~/.ssh/id_test.pub >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
# Establish environment variables for subsequent steps
echo "SSH_USER=$(whoami)" >> "$GITHUB_ENV"
echo "TEST_REMOTE_DIR=$HOME/ssh_deploy_test" >> "$GITHUB_ENV"
# Write the private key to GitHub/Gitea env securely using multiline syntax
echo "SSH_PRIVATE_KEY<<EOF" >> "$GITHUB_ENV"
cat ~/.ssh/id_test >> "$GITHUB_ENV"
@@ -166,7 +169,7 @@ jobs:
STATUS=$(docker ps --filter "name=pipeline-actions-ssh-test" --format "{{.Status}}")
echo "Container status: ${STATUS}"
echo "${STATUS}" | grep -q "Up" || { echo "Container is not running"; exit 1; }
echo "Checking image pin..."
IMAGE_USED=$(docker inspect pipeline-actions-ssh-test --format '{{.Config.Image}}')
echo "Container is using image: ${IMAGE_USED}"