2020-08-26 23:45:17 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: register
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
clone:
|
|
|
|
disable: true
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
exclude:
|
|
|
|
- promote
|
|
|
|
|
2020-08-26 23:14:17 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: deploy
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: print env
|
2020-08-28 20:51:50 +00:00
|
|
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
2020-08-26 23:14:17 +00:00
|
|
|
settings:
|
|
|
|
envs:
|
|
|
|
- drone_tag
|
|
|
|
- drone_commit
|
|
|
|
- drone_build_number
|
|
|
|
- drone_repo_name
|
|
|
|
- drone_repo_namespace
|
2020-08-28 20:51:50 +00:00
|
|
|
- registry_domain
|
|
|
|
- registry_port
|
2020-08-26 23:14:17 +00:00
|
|
|
- registry_password
|
2020-08-28 20:51:50 +00:00
|
|
|
- domain
|
2020-08-26 23:14:17 +00:00
|
|
|
- drone_gitea_client_id
|
|
|
|
- drone_gitea_server
|
|
|
|
- drone_server_host
|
2020-08-28 20:51:50 +00:00
|
|
|
- ssh_host
|
|
|
|
- ssh_user
|
|
|
|
- ssh_port
|
2020-08-26 23:14:17 +00:00
|
|
|
- drone_gitea_client_secret
|
|
|
|
- drone_rpc_secret
|
2020-08-28 20:51:50 +00:00
|
|
|
- ssh_key
|
|
|
|
host: ${SSH_HOST}
|
|
|
|
key: ${SSH_KEY}
|
|
|
|
passphrase: ${SSH_PASSPHRASE}
|
|
|
|
port: ${SSH_PORT}
|
2020-08-26 23:14:17 +00:00
|
|
|
script:
|
|
|
|
- rm -f env-drone
|
2020-08-28 20:51:50 +00:00
|
|
|
- "echo \"export REGISTRY_DOMAIN='$${REGISTRY_DOMAIN}'\" >> env-drone # \"registry-domain\""
|
|
|
|
- "echo \"export REGISTRY_PORT='$${REGISTRY_PORT}'\" >> env-drone # \"registry-port\""
|
2020-08-26 23:14:17 +00:00
|
|
|
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-drone # \"registry-password\""
|
2020-08-28 20:51:50 +00:00
|
|
|
- "echo \"export DOMAIN='$${DOMAIN}'\" >> env-drone # \"domain\""
|
2020-08-26 23:14:17 +00:00
|
|
|
- "echo \"export DRONE_GITEA_CLIENT_ID='$${DRONE_GITEA_CLIENT_ID}'\" >> env-drone # \"drone-gitea-client-id\""
|
|
|
|
- "echo \"export DRONE_GITEA_SERVER='$${DRONE_GITEA_SERVER}'\" >> env-drone # \"drone-gitea-server\""
|
|
|
|
- "echo \"export DRONE_SERVER_HOST='$${DRONE_SERVER_HOST}'\" >> env-drone # \"drone-server-host\""
|
2020-08-28 20:51:50 +00:00
|
|
|
- "echo \"export SSH_HOST='$${SSH_HOST}'\" >> env-drone # \"ssh-host\""
|
|
|
|
- "echo \"export SSH_USER='$${SSH_USER}'\" >> env-drone # \"ssh-user\""
|
|
|
|
- "echo \"export SSH_PORT='$${SSH_PORT}'\" >> env-drone # \"ssh-port\""
|
2020-08-26 23:14:17 +00:00
|
|
|
- "echo \"export DRONE_GITEA_CLIENT_SECRET='$${DRONE_GITEA_CLIENT_SECRET}'\" >> env-drone # \"drone-gitea-client-secret\""
|
|
|
|
- "echo \"export DRONE_RPC_SECRET='$${DRONE_RPC_SECRET}'\" >> env-drone # \"drone-rpc-secret\""
|
2020-08-28 20:51:50 +00:00
|
|
|
- "echo \"export SSH_KEY='$${SSH_KEY}'\" >> env-drone # \"ssh-key\""
|
|
|
|
username: ${SSH_USER}
|
2020-08-26 23:14:17 +00:00
|
|
|
environment:
|
2020-08-28 20:51:50 +00:00
|
|
|
DOMAIN:
|
|
|
|
from_secret: domain
|
2020-08-26 23:14:17 +00:00
|
|
|
DRONE_GITEA_CLIENT_ID:
|
|
|
|
from_secret: drone-gitea-client-id
|
|
|
|
DRONE_GITEA_CLIENT_SECRET:
|
|
|
|
from_secret: drone-gitea-client-secret
|
|
|
|
DRONE_GITEA_SERVER:
|
|
|
|
from_secret: drone-gitea-server
|
|
|
|
DRONE_RPC_SECRET:
|
|
|
|
from_secret: drone-rpc-secret
|
|
|
|
DRONE_SERVER_HOST:
|
|
|
|
from_secret: drone-server-host
|
2020-08-28 20:51:50 +00:00
|
|
|
REGISTRY_DOMAIN:
|
|
|
|
from_secret: registry-domain
|
2020-08-26 23:14:17 +00:00
|
|
|
REGISTRY_PASSWORD:
|
|
|
|
from_secret: registry-password
|
2020-08-28 20:51:50 +00:00
|
|
|
REGISTRY_PORT:
|
|
|
|
from_secret: registry-port
|
|
|
|
SSH_HOST:
|
|
|
|
from_secret: ssh-host
|
|
|
|
SSH_KEY:
|
|
|
|
from_secret: ssh-key
|
|
|
|
SSH_PORT:
|
|
|
|
from_secret: ssh-port
|
|
|
|
SSH_USER:
|
|
|
|
from_secret: ssh-user
|
2020-08-26 23:14:17 +00:00
|
|
|
|
|
|
|
- name: scp
|
2020-08-28 20:51:50 +00:00
|
|
|
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
2020-08-26 23:14:17 +00:00
|
|
|
settings:
|
|
|
|
command_timeout: 2m
|
2020-08-28 20:51:50 +00:00
|
|
|
host: ${SSH_HOST}
|
|
|
|
key: ${SSH_KEY}
|
|
|
|
passphrase: ${SSH_PASSPHRASE}
|
|
|
|
port: ${SSH_PORT}
|
2020-08-26 23:14:17 +00:00
|
|
|
source:
|
|
|
|
- .
|
|
|
|
target: /stack/drone
|
2020-08-28 20:51:50 +00:00
|
|
|
username: ${SSH_USER}
|
2020-08-26 23:14:17 +00:00
|
|
|
|
|
|
|
- name: wait
|
2020-08-28 20:51:50 +00:00
|
|
|
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
|
2020-08-26 23:14:17 +00:00
|
|
|
commands:
|
|
|
|
- sleep 15
|
|
|
|
|
|
|
|
- name: "dockerbuild:"
|
2020-08-28 20:51:50 +00:00
|
|
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
2020-08-26 23:14:17 +00:00
|
|
|
commands:
|
|
|
|
- set -e
|
|
|
|
- sh .drone/login.sh
|
|
|
|
- sh .drone/build.sh
|
|
|
|
- sh .drone/push.sh
|
|
|
|
- sh .drone/logout.sh
|
|
|
|
environment:
|
2020-08-28 20:51:50 +00:00
|
|
|
REGISTRY_DOMAIN:
|
|
|
|
from_secret: registry-domain
|
2020-08-26 23:14:17 +00:00
|
|
|
REGISTRY_PASSWORD:
|
|
|
|
from_secret: registry-password
|
2020-08-28 20:51:50 +00:00
|
|
|
REGISTRY_PORT:
|
|
|
|
from_secret: registry-port
|
2020-08-26 23:14:17 +00:00
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
|
|
|
|
- name: deploy
|
2020-08-28 20:51:50 +00:00
|
|
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
2020-08-26 23:14:17 +00:00
|
|
|
settings:
|
|
|
|
envs:
|
|
|
|
- drone_tag
|
|
|
|
- drone_commit
|
|
|
|
- drone_build_number
|
|
|
|
- drone_repo_name
|
|
|
|
- drone_repo_namespace
|
2020-08-28 20:51:50 +00:00
|
|
|
- domain
|
2020-08-26 23:14:17 +00:00
|
|
|
- drone_gitea_client_id
|
|
|
|
- drone_gitea_server
|
|
|
|
- drone_server_host
|
2020-08-28 20:51:50 +00:00
|
|
|
- ssh_host
|
|
|
|
- ssh_user
|
|
|
|
- ssh_port
|
2020-08-26 23:14:17 +00:00
|
|
|
- drone_gitea_client_secret
|
|
|
|
- drone_rpc_secret
|
2020-08-28 20:51:50 +00:00
|
|
|
- ssh_key
|
|
|
|
- registry_domain
|
|
|
|
- registry_port
|
2020-08-26 23:14:17 +00:00
|
|
|
- registry_password
|
2020-08-28 20:51:50 +00:00
|
|
|
host: ${SSH_HOST}
|
|
|
|
key: ${SSH_KEY}
|
|
|
|
passphrase: ${SSH_PASSPHRASE}
|
|
|
|
port: ${SSH_PORT}
|
2020-08-26 23:14:17 +00:00
|
|
|
script:
|
|
|
|
- export DRONE_GITEA_CLIENT_SECRET=$${DRONE_GITEA_CLIENT_SECRET}
|
|
|
|
- export DRONE_RPC_SECRET=$${DRONE_RPC_SECRET}
|
2020-08-28 20:51:50 +00:00
|
|
|
- export SSH_KEY=$${SSH_KEY}
|
|
|
|
- export DOMAIN=$${DOMAIN}
|
2020-08-26 23:14:17 +00:00
|
|
|
- export DRONE_GITEA_CLIENT_ID=$${DRONE_GITEA_CLIENT_ID}
|
|
|
|
- export DRONE_GITEA_SERVER=$${DRONE_GITEA_SERVER}
|
|
|
|
- export DRONE_SERVER_HOST=$${DRONE_SERVER_HOST}
|
2020-08-28 20:51:50 +00:00
|
|
|
- export SSH_HOST=$${SSH_HOST}
|
|
|
|
- export SSH_USER=$${SSH_USER}
|
|
|
|
- export SSH_PORT=$${SSH_PORT}
|
|
|
|
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
|
|
|
|
- export REGISTRY_PORT=$${REGISTRY_PORT}
|
2020-08-26 23:14:17 +00:00
|
|
|
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
|
|
|
- set -e
|
|
|
|
- cd /stack/drone
|
|
|
|
- sh .drone/login.sh
|
|
|
|
- sh .drone/pull.sh
|
|
|
|
- sh .drone/deploy.sh
|
2020-08-28 20:51:50 +00:00
|
|
|
username: ${SSH_USER}
|
2020-08-26 23:14:17 +00:00
|
|
|
environment:
|
2020-08-28 20:51:50 +00:00
|
|
|
DOMAIN:
|
|
|
|
from_secret: domain
|
2020-08-26 23:14:17 +00:00
|
|
|
DRONE_GITEA_CLIENT_ID:
|
|
|
|
from_secret: drone-gitea-client-id
|
|
|
|
DRONE_GITEA_CLIENT_SECRET:
|
|
|
|
from_secret: drone-gitea-client-secret
|
|
|
|
DRONE_GITEA_SERVER:
|
|
|
|
from_secret: drone-gitea-server
|
|
|
|
DRONE_RPC_SECRET:
|
|
|
|
from_secret: drone-rpc-secret
|
|
|
|
DRONE_SERVER_HOST:
|
|
|
|
from_secret: drone-server-host
|
2020-08-28 20:51:50 +00:00
|
|
|
REGISTRY_DOMAIN:
|
|
|
|
from_secret: registry-domain
|
2020-08-26 23:14:17 +00:00
|
|
|
REGISTRY_PASSWORD:
|
|
|
|
from_secret: registry-password
|
2020-08-28 20:51:50 +00:00
|
|
|
REGISTRY_PORT:
|
|
|
|
from_secret: registry-port
|
|
|
|
SSH_HOST:
|
|
|
|
from_secret: ssh-host
|
|
|
|
SSH_KEY:
|
|
|
|
from_secret: ssh-key
|
|
|
|
SSH_PORT:
|
|
|
|
from_secret: ssh-port
|
|
|
|
SSH_USER:
|
|
|
|
from_secret: ssh-user
|
2020-08-26 23:14:17 +00:00
|
|
|
|
|
|
|
services:
|
|
|
|
- name: docker
|
2020-08-28 20:51:50 +00:00
|
|
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
2020-08-26 23:14:17 +00:00
|
|
|
privileged: true
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
- name: ca
|
|
|
|
path: /etc/docker/certs.d
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
temp: {}
|
|
|
|
- name: ca
|
|
|
|
host:
|
|
|
|
path: /etc/docker/certs.d
|
|
|
|
|
2020-08-26 23:45:17 +00:00
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- production
|
|
|
|
|
2020-08-26 23:14:17 +00:00
|
|
|
...
|