From 115ac06cefcd74078c0d2707b418d8e492c1af39 Mon Sep 17 00:00:00 2001 From: idanoo Date: Mon, 12 Sep 2022 17:50:17 +1200 Subject: [PATCH] Add deploy key to ssh-agent --- .woodpecker.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 2d022a2..691040a 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -4,8 +4,7 @@ pipeline: commands: - apk update - apk add openssh - - echo $M2_DEPLOY_KEY > privkey - - chmod 0600 privkey - - ssh -i privkey -o StrictHostKeyChecking=no root@$M2_HOST 'cd /var/www/m2.nz && git pull && chown www-data:users -R /var/www/m2.nz && sudo systemctl reload nginx.service' - - rm -fr privkey + - eval $(ssh-agent -s) + - echo "$M2_DEPLOY_KEY" | tr -d '\r' | ssh-add - + - ssh -o StrictHostKeyChecking=no root@$M2_HOST 'cd /var/www/m2.nz && git pull && chown www-data:users -R /var/www/m2.nz && sudo systemctl reload nginx.service' secrets: [ m2_deploy_key, m2_host ]