2022-09-26 20:27:41 +02:00
|
|
|
kind: pipeline
|
2022-09-26 21:02:49 +02:00
|
|
|
type: docker
|
2022-09-26 20:27:41 +02:00
|
|
|
name: hello
|
|
|
|
|
|
|
|
steps:
|
2022-09-26 21:46:31 +02:00
|
|
|
- name: deploy
|
2022-09-26 21:38:22 +02:00
|
|
|
image: ubuntu
|
2022-09-26 21:46:31 +02:00
|
|
|
environment:
|
|
|
|
HOST:
|
|
|
|
from_secret: host
|
2022-09-26 22:58:32 +02:00
|
|
|
USER:
|
|
|
|
from_secret: user
|
2022-09-26 21:46:31 +02:00
|
|
|
SSH_KEY:
|
|
|
|
from_secret: ssh_key
|
2022-09-26 23:11:40 +02:00
|
|
|
SRC: content
|
2022-09-26 23:07:14 +02:00
|
|
|
DEST: gemini/content
|
2022-09-26 21:46:31 +02:00
|
|
|
|
2022-09-26 20:27:41 +02:00
|
|
|
commands:
|
2022-09-26 23:11:40 +02:00
|
|
|
# install stuff
|
2022-09-26 21:46:31 +02:00
|
|
|
- apt-get update -qq > /dev/null
|
2022-09-26 22:54:01 +02:00
|
|
|
- apt-get install ssh rsync -qq > /dev/null
|
2022-09-26 23:11:40 +02:00
|
|
|
|
|
|
|
# configure ssh identity
|
2022-09-26 21:46:31 +02:00
|
|
|
- which ssh-agent
|
|
|
|
- eval $(ssh-agent -s)
|
|
|
|
- mkdir -p ~/.ssh
|
2022-09-26 23:11:40 +02:00
|
|
|
# import ssh key
|
|
|
|
- echo "$SSH_KEY" > ~/.ssh/identity
|
|
|
|
- chmod 600 ~/.ssh/identity
|
2022-09-26 21:46:31 +02:00
|
|
|
- ssh-add
|
|
|
|
# skip key checking
|
|
|
|
- echo "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
|
2022-09-26 23:11:40 +02:00
|
|
|
|
|
|
|
# run operations on the remote host
|
2022-09-26 23:07:14 +02:00
|
|
|
- ssh "$${USER}@$${HOST}" "[[ -d $${DEST} ]] && rm -r $${DEST}"
|
2022-09-26 23:11:40 +02:00
|
|
|
- rsync -rP "$SRC"/* "$${USER}@$${HOST}:$${DEST}"
|