From a88c0ace310ee069b64e10b1e501b2458cd87104 Mon Sep 17 00:00:00 2001
From: Ludger Sicking <sicking@comenius.de>
Date: Tue, 1 Oct 2024 08:30:59 +0200
Subject: [PATCH] erster Woodpecker-Versuch

---
 .woodpecker/basic-ssh-on-alpine.yaml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 .woodpecker/basic-ssh-on-alpine.yaml

diff --git a/.woodpecker/basic-ssh-on-alpine.yaml b/.woodpecker/basic-ssh-on-alpine.yaml
new file mode 100644
index 0000000..6d79649
--- /dev/null
+++ b/.woodpecker/basic-ssh-on-alpine.yaml
@@ -0,0 +1,21 @@
+steps:
+  ssh_connect:
+    image: alpine
+    environment:
+      SSH_HOST:
+        from_secret: ssh_host
+      SSH_USER:
+        from_secret: ssh_user
+      SSH_KEY:
+        from_secret: ssh_key
+      SSH_PORT:
+        from_secret: ssh_port
+    commands:
+      - apk add --no-cache openssh
+      - mkdir -p ~/.ssh
+      - echo "$SSH_KEY" | tr -d '\r' > ~/.ssh/deployKey # the private key generated locally outside git/woodpecker...
+      - chmod 600 ~/.ssh/deployKey
+      - ssh-keyscan -t rsa $SSH_HOST 2>/dev/null >> ~/.ssh/known_hosts
+      - chmod 600 ~/.ssh/known_hosts
+      #target user has to allow ssh connection of course
+      - ssh -vvvv -i ~/.ssh/deployKey -p $SSH_PORT $SSH_USER@$SSH_HOST "echo 'deployed by woodpecker' > ci_pipeline_is_ready.log"