Download file from a host to local or Use temporary volume
jessequinn opened this issue · comments
Jesse Quinn commented
Hi
Is it possible, or do you have a suggestion, on how to, for instance, scp a file from a host to a temp volume or directly to the local machine?
Any information would be greatly appreciated.
Jesse Quinn commented
nvm,
i ended using alpine
- name: move
image: alpine:3.11.3
volumes:
- name: cache
path: /backup
environment:
SSH_HOST: host.local
SSH_USER:
from_secret: rsync_user
SSH_KEY:
from_secret: rsync_key
commands:
- apk add --no-cache openssh-client
- mkdir -p /root/.ssh
- printf "StrictHostKeyChecking no\n" > "/root/.ssh/config"
- chmod 0700 "/root/.ssh/config"
- echo "$SSH_KEY" > "/root/.ssh/id_rsa"
- chmod 0600 "/root/.ssh/id_rsa"
- mkdir -p /backup/${DRONE_REPO}
- scp -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST:/tmp/${DRONE_COMMIT}.tar.bz2 /backup/${DRONE_REPO}
when:
branch:
- develop