2023-02-21 00:30:26 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2023-02-21 00:37:16 +00:00
|
|
|
name: deploy
|
2023-02-21 00:30:26 +00:00
|
|
|
|
2023-02-21 01:56:05 +00:00
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
2023-02-21 02:00:03 +00:00
|
|
|
pool:
|
|
|
|
use: ubuntu:latest
|
2023-02-21 01:56:05 +00:00
|
|
|
|
2023-02-21 01:23:30 +00:00
|
|
|
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
|
|
|
|
|
2023-02-21 00:30:26 +00:00
|
|
|
steps:
|
2023-02-21 01:23:30 +00:00
|
|
|
- name: configure-environment
|
2023-02-21 00:37:16 +00:00
|
|
|
pull: always
|
2023-02-21 02:00:03 +00:00
|
|
|
image: bitnami/git:2.39.2
|
|
|
|
volumes:
|
|
|
|
- name: ssh
|
|
|
|
path: ~/.ssh
|
2023-02-21 01:41:31 +00:00
|
|
|
environment:
|
2023-02-21 02:00:03 +00:00
|
|
|
SSH_PRIVATE_KEY:
|
|
|
|
from_secret: dokku_ssh_key
|
|
|
|
JUMP_PRIVATE_KEY:
|
|
|
|
from_secret: dokku_ssh_key
|
2023-02-21 00:37:16 +00:00
|
|
|
commands:
|
|
|
|
- mkdir -p ~/.ssh
|
2023-02-21 01:23:30 +00:00
|
|
|
- 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
|
2023-02-21 02:02:35 +00:00
|
|
|
- echo -e "Host *\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null" > ~/.ssh/config.jump
|
2023-02-21 01:23:30 +00:00
|
|
|
- echo -e "Host *\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null" > ~/.ssh/config.dokku
|
|
|
|
- chmod 400 ~/.ssh/config.jump
|
|
|
|
- chmod 400 ~/.ssh/config.dokku
|
2023-02-21 01:32:36 +00:00
|
|
|
- echo "$JUMP_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
|
|
- chmod 600 ~/.ssh/id_rsa
|
2023-02-21 01:47:34 +00:00
|
|
|
- apt-get update && apt-get install git -y
|
2023-02-21 01:23:30 +00:00
|
|
|
- name: add-remote
|
2023-02-21 02:00:03 +00:00
|
|
|
image: bitnami/git:2.39.2
|
|
|
|
volumes:
|
|
|
|
- name: ssh
|
|
|
|
path: ~/.ssh
|
2023-02-21 01:23:30 +00:00
|
|
|
commands:
|
|
|
|
- git remote add dokku dokku:$DOKKU_APP_NAME
|
|
|
|
- name: push-to-dokku
|
2023-02-21 02:00:03 +00:00
|
|
|
image: bitnami/git:2.39.2
|
|
|
|
volumes:
|
|
|
|
- name: ssh
|
|
|
|
path: ~/.ssh
|
2023-02-21 01:23:30 +00:00
|
|
|
commands:
|
|
|
|
- git push dokku $BRANCH
|
2023-02-21 00:30:26 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
branch:
|
|
|
|
- main
|