62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: deploy
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
volumes:
|
|
- name: ssh
|
|
temp: {}
|
|
|
|
environment:
|
|
BRANCH: main
|
|
DOKKU_HOST: apps1.fnukinternal.net
|
|
DOKKU_APP_NAME: dokku-ci-deploy
|
|
DOKKU_USER: dokku
|
|
JUMP_HOST: 192.168.0.24
|
|
JUMP_USER: jumpuser
|
|
|
|
steps:
|
|
- name: configure-environment
|
|
pull: always
|
|
image: bitnami/git:2.39.2
|
|
volumes:
|
|
- name: ssh
|
|
path: /root/.ssh
|
|
environment:
|
|
SSH_PRIVATE_KEY:
|
|
from_secret: dokku_ssh_key
|
|
JUMP_PRIVATE_KEY:
|
|
from_secret: dokku_ssh_key
|
|
commands:
|
|
- mkdir -p ~/.ssh
|
|
- echo -e "Host jump\n Hostname $JUMP_HOST\n User $JUMP_USER\n IdentityFile ~/.ssh/id_rsa\n StrictHostKeyChecking no" > ~/.ssh/config
|
|
- echo -e "Host dokku\n Hostname $DOKKU_HOST\n User $DOKKU_USER\n IdentityFile ~/.ssh/id_rsa\n ProxyCommand ssh -o 'StrictHostKeyChecking no' jump nc %h %p" >> ~/.ssh/config
|
|
- chmod 400 ~/.ssh/config
|
|
- echo -e "Host *\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null" > ~/.ssh/config.jump
|
|
- echo -e "Host *\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null" > ~/.ssh/config.dokku
|
|
- chmod 400 ~/.ssh/config.jump
|
|
- chmod 400 ~/.ssh/config.dokku
|
|
- echo "$JUMP_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
- chmod 600 ~/.ssh/id_rsa
|
|
- name: add-remote
|
|
image: bitnami/git:2.39.2
|
|
volumes:
|
|
- name: ssh
|
|
path: /root/.ssh
|
|
commands:
|
|
- git remote add dokku dokku:$DOKKU_APP_NAME
|
|
- name: push-to-dokku
|
|
image: bitnami/git:2.39.2
|
|
volumes:
|
|
- name: ssh
|
|
path: /root/.ssh
|
|
commands:
|
|
- ls -la ~/.ssh
|
|
- git push dokku $BRANCH
|
|
|
|
trigger:
|
|
branch:
|
|
- main
|