Add deploy key to ssh-agent

This commit is contained in:
idanoo 2022-09-12 17:50:17 +12:00
parent c9b68342ad
commit 115ac06cef
Signed by: idanoo
GPG Key ID: 387387CDBC02F132

View File

@ -4,8 +4,7 @@ pipeline:
commands: commands:
- apk update - apk update
- apk add openssh - apk add openssh
- echo $M2_DEPLOY_KEY > privkey - eval $(ssh-agent -s)
- chmod 0600 privkey - echo "$M2_DEPLOY_KEY" | tr -d '\r' | ssh-add -
- 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' - 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'
- rm -fr privkey
secrets: [ m2_deploy_key, m2_host ] secrets: [ m2_deploy_key, m2_host ]