From 4246e282472fa03e43940a094a8886e1977f0a0c Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 15 Jun 2021 00:25:50 +0200 Subject: [PATCH] feat: move ssh setup into own setup_ssh.sh script --- .drone.yml | 18 ++---------------- .drone/setup_ssh.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 16 deletions(-) create mode 100755 .drone/setup_ssh.sh diff --git a/.drone.yml b/.drone.yml index 83978429..d11b6307 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,14 +19,7 @@ steps: from_secret: gitea_ssh_key HOME: /root commands: - # This is a hack because nixery containers contain no passwd file, which openssh wants to read - - echo "root:x:0:0:System administrator:/root:/run/current-system/sw/bin/bash" >> /etc/passwd - - mkdir -p ~/.ssh - - echo "$$GITEA_SSH_KEY" > ~/.ssh/id_rsa - - echo "[git.b12f.io]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ4uaREL7acSSCNAX+voDYl1Kj7JipP62fR5x1UyGP9u" >> ~/.ssh/known_hosts - - echo "Host git.b12f.io" >> ~/.ssh/config - - echo " Port 2222" >> ~/.ssh/config - - chmod -R 600 ~/.ssh + - ./.drone/setup_ssh.sh - git clone -b devos git@git.b12f.io:pub-solar/os . - git remote add devos git@git.b12f.io:pub-solar/devos - git fetch --all @@ -50,14 +43,7 @@ steps: from_secret: gitea_ssh_key HOME: /root commands: - # This is a hack because nixery containers contain no passwd file, which openssh wants to read - - echo "root:x:0:0:System administrator:/root:/run/current-system/sw/bin/bash" >> /etc/passwd - - mkdir -p ~/.ssh - - echo "$$GITEA_SSH_KEY" > ~/.ssh/id_rsa - - echo "[git.b12f.io]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ4uaREL7acSSCNAX+voDYl1Kj7JipP62fR5x1UyGP9u" >> ~/.ssh/known_hosts - - echo "Host git.b12f.io" >> ~/.ssh/config - - echo " Port 2222" >> ~/.ssh/config - - chmod -R 600 ~/.ssh + - ./.drone/setup_ssh.sh - git fetch --all - git checkout --track origin/core - git merge origin/devos diff --git a/.drone/setup_ssh.sh b/.drone/setup_ssh.sh new file mode 100755 index 00000000..c43f1063 --- /dev/null +++ b/.drone/setup_ssh.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Setup ssh inside container +# This is a hack because nixery containers contain no passwd file, which openssh wants to read +echo "root:x:0:0:System administrator:/root:/run/current-system/sw/bin/bash" >> /etc/passwd +mkdir -p ~/.ssh +echo "$GITEA_SSH_KEY" > ~/.ssh/id_rsa +echo "[git.b12f.io]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ4uaREL7acSSCNAX+voDYl1Kj7JipP62fR5x1UyGP9u" >> ~/.ssh/known_hosts +echo "Host git.b12f.io" >> ~/.ssh/config +echo " Port 2222" >> ~/.ssh/config +chmod -R 600 ~/.ssh