feat: move ssh setup into own setup_ssh.sh script

This commit is contained in:
teutat3s 2021-06-15 00:25:50 +02:00
parent e67ce93376
commit 4246e28247
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
2 changed files with 12 additions and 16 deletions

View file

@ -19,14 +19,7 @@ steps:
from_secret: gitea_ssh_key from_secret: gitea_ssh_key
HOME: /root HOME: /root
commands: commands:
# This is a hack because nixery containers contain no passwd file, which openssh wants to read - ./.drone/setup_ssh.sh
- 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
- git clone -b devos git@git.b12f.io:pub-solar/os . - git clone -b devos git@git.b12f.io:pub-solar/os .
- git remote add devos git@git.b12f.io:pub-solar/devos - git remote add devos git@git.b12f.io:pub-solar/devos
- git fetch --all - git fetch --all
@ -50,14 +43,7 @@ steps:
from_secret: gitea_ssh_key from_secret: gitea_ssh_key
HOME: /root HOME: /root
commands: commands:
# This is a hack because nixery containers contain no passwd file, which openssh wants to read - ./.drone/setup_ssh.sh
- 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
- git fetch --all - git fetch --all
- git checkout --track origin/core - git checkout --track origin/core
- git merge origin/devos - git merge origin/devos

10
.drone/setup_ssh.sh Executable file
View file

@ -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