Compare commits

...

43 Commits

Author SHA1 Message Date
Giles Bradshaw 823abc8289 .
continuous-integration/drone/push Build is passing Details
2020-09-22 12:12:14 +01:00
Giles Bradshaw 613c03b193 . 2020-09-22 12:06:40 +01:00
Giles Bradshaw c9d91569db . 2020-09-22 11:46:06 +01:00
Giles Bradshaw 660a573678 .
continuous-integration/drone/push Build is passing Details
2020-09-22 11:34:11 +01:00
Giles Bradshaw f369c07b17 . 2020-09-22 11:28:17 +01:00
Giles Bradshaw 7a39cefc00 . 2020-09-22 11:24:03 +01:00
Giles Bradshaw 2b8825cf86 . 2020-09-22 11:22:34 +01:00
Giles Bradshaw 1cbfd70b3e . 2020-09-22 11:21:40 +01:00
Giles Bradshaw 7168b57c05 . 2020-09-22 11:20:57 +01:00
Giles Bradshaw aa2c4d3233 . 2020-09-22 11:16:31 +01:00
Giles Bradshaw 8eb8efc14e . 2020-09-22 11:13:04 +01:00
Giles Bradshaw cc824b438e . 2020-09-22 11:11:55 +01:00
Giles Bradshaw a18c423a5b . 2020-09-22 11:10:59 +01:00
Giles Bradshaw a4ea555cf2 . 2020-09-22 11:10:02 +01:00
Giles Bradshaw 917dcf8be3 . 2020-09-22 11:08:01 +01:00
Giles Bradshaw fc80a55d38 . 2020-09-22 11:01:47 +01:00
Giles Bradshaw 2b0c16a963 . 2020-09-22 11:00:34 +01:00
Giles Bradshaw e80329d17e . 2020-09-22 10:58:46 +01:00
Giles Bradshaw 4a1760b858 . 2020-09-22 10:56:44 +01:00
Giles Bradshaw 1893d59dd8 . 2020-09-22 10:51:16 +01:00
Giles Bradshaw cbcc794d19 . 2020-09-22 10:49:55 +01:00
Giles Bradshaw c3a63307b8 . 2020-09-22 10:48:55 +01:00
Giles Bradshaw e43dc9e43a . 2020-09-22 10:41:21 +01:00
Giles Bradshaw fbfd7a0a51 . 2020-09-22 10:40:57 +01:00
Giles Bradshaw 9e908bab59 . 2020-09-22 10:40:21 +01:00
Giles Bradshaw ae2f946c4a . 2020-09-22 10:32:34 +01:00
Giles Bradshaw 0ab3b5fe8c . 2020-09-22 10:29:34 +01:00
Giles Bradshaw f4f84dbef0 . 2020-09-22 10:26:31 +01:00
Giles Bradshaw 5dc23e2ff4 . 2020-09-22 10:24:36 +01:00
Giles Bradshaw 9cecf4228b . 2020-09-22 10:20:03 +01:00
Giles Bradshaw dbfb050e8c . 2020-09-22 10:16:22 +01:00
Giles Bradshaw d2be2b84ab . 2020-09-22 10:12:37 +01:00
Giles Bradshaw fd2b0a69b7 . 2020-09-22 10:12:07 +01:00
Giles Bradshaw 20d63e3b86 . 2020-09-22 10:11:13 +01:00
Giles Bradshaw be8b531e5d . 2020-09-22 10:09:15 +01:00
Giles Bradshaw b67829dde9 . 2020-09-22 10:07:02 +01:00
Giles Bradshaw 71736fa726 . 2020-09-22 10:06:19 +01:00
Giles Bradshaw 9a5dfad5a5 . 2020-09-22 10:04:02 +01:00
Giles Bradshaw f60d5b35ce . 2020-09-22 10:03:03 +01:00
Giles Bradshaw 9a559a9fd6 . 2020-09-22 10:02:21 +01:00
Giles Bradshaw 7ee2accafb . 2020-09-22 10:01:02 +01:00
Giles Bradshaw e0ef961fda .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build was killed Details
2020-09-22 09:58:32 +01:00
Giles Bradshaw a85cf890f1 ci: drone.yml 2020-09-22 09:22:58 +01:00
7 changed files with 247 additions and 27 deletions

View File

@ -42,15 +42,11 @@ steps:
- drone_gitea_server
- drone_server_host
- ssh_host
- ssh_user
- ssh_username
- ssh_port
- drone_gitea_client_secret
- drone_rpc_secret
- ssh_key
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script:
- rm -f env-drone
- "echo \"export REGISTRY_DOMAIN='$${REGISTRY_DOMAIN}'\" >> env-drone # \"registry-domain\""
@ -61,12 +57,11 @@ steps:
- "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\""
- "echo \"export SSH_HOST='$${SSH_HOST}'\" >> env-drone # \"ssh-host\""
- "echo \"export SSH_USER='$${SSH_USER}'\" >> env-drone # \"ssh-user\""
- "echo \"export SSH_USERNAME='$${SSH_USERNAME}'\" >> env-drone # \"ssh-username\""
- "echo \"export SSH_PORT='$${SSH_PORT}'\" >> env-drone # \"ssh-port\""
- "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\""
- "echo \"export SSH_KEY='$${SSH_KEY}'\" >> env-drone # \"ssh-key\""
username: ${SSH_USER}
environment:
DOMAIN:
from_secret: domain
@ -92,21 +87,16 @@ steps:
from_secret: ssh-key
SSH_PORT:
from_secret: ssh-port
SSH_USER:
from_secret: ssh-user
SSH_USERNAME:
from_secret: ssh-username
- name: scp
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
settings:
command_timeout: 2m
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
source:
- .
target: /stack/drone
username: ${SSH_USER}
- name: wait
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
@ -146,7 +136,7 @@ steps:
- drone_gitea_server
- drone_server_host
- ssh_host
- ssh_user
- ssh_username
- ssh_port
- drone_gitea_client_secret
- drone_rpc_secret
@ -154,10 +144,6 @@ steps:
- registry_domain
- registry_port
- registry_password
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script:
- export DRONE_GITEA_CLIENT_SECRET=$${DRONE_GITEA_CLIENT_SECRET}
- export DRONE_RPC_SECRET=$${DRONE_RPC_SECRET}
@ -167,7 +153,7 @@ steps:
- export DRONE_GITEA_SERVER=$${DRONE_GITEA_SERVER}
- export DRONE_SERVER_HOST=$${DRONE_SERVER_HOST}
- export SSH_HOST=$${SSH_HOST}
- export SSH_USER=$${SSH_USER}
- export SSH_USERNAME=$${SSH_USERNAME}
- export SSH_PORT=$${SSH_PORT}
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
- export REGISTRY_PORT=$${REGISTRY_PORT}
@ -177,7 +163,6 @@ steps:
- sh .drone/login.sh
- sh .drone/pull.sh
- sh .drone/deploy.sh
username: ${SSH_USER}
environment:
DOMAIN:
from_secret: domain
@ -203,8 +188,8 @@ steps:
from_secret: ssh-key
SSH_PORT:
from_secret: ssh-port
SSH_USER:
from_secret: ssh-user
SSH_USERNAME:
from_secret: ssh-username
services:
- name: docker

21
.drone/drone.jsonnet Normal file
View File

@ -0,0 +1,21 @@
local secretSecrets = import 'lib/secret-secrets.libsonnet';
local publicSecrets = import 'lib/public-secrets.libsonnet';
local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
local register = import 'node_modules/@sigyl/jsonnet-drone/register.libsonnet';
[
register,
deploy(
'drone',
'/stack/',
[
'REGISTRY_DOMAIN',
'REGISTRY_PORT',
'REGISTRY_PASSWORD',
],
publicSecrets,
secretSecrets,
[],
),
]

211
.drone/drone.yml Normal file
View File

@ -0,0 +1,211 @@
---
kind: pipeline
type: docker
name: register
platform:
os: linux
arch: amd64
clone:
disable: true
trigger:
event:
exclude:
- promote
---
kind: pipeline
type: docker
name: deploy
platform:
os: linux
arch: amd64
steps:
- name: print env
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- registry_domain
- registry_port
- registry_password
- domain
- drone_gitea_client_id
- drone_gitea_server
- drone_server_host
- ssh_host
- ssh_username
- ssh_port
- drone_gitea_client_secret
- drone_rpc_secret
- ssh_key
script:
- rm -f env-drone
- "echo \"export REGISTRY_DOMAIN='$${REGISTRY_DOMAIN}'\" >> env-drone # \"registry-domain\""
- "echo \"export REGISTRY_PORT='$${REGISTRY_PORT}'\" >> env-drone # \"registry-port\""
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-drone # \"registry-password\""
- "echo \"export DOMAIN='$${DOMAIN}'\" >> env-drone # \"domain\""
- "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\""
- "echo \"export SSH_HOST='$${SSH_HOST}'\" >> env-drone # \"ssh-host\""
- "echo \"export SSH_USERNAME='$${SSH_USERNAME}'\" >> env-drone # \"ssh-username\""
- "echo \"export SSH_PORT='$${SSH_PORT}'\" >> env-drone # \"ssh-port\""
- "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\""
- "echo \"export SSH_KEY='$${SSH_KEY}'\" >> env-drone # \"ssh-key\""
environment:
DOMAIN:
from_secret: domain
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
REGISTRY_DOMAIN:
from_secret: registry-domain
REGISTRY_PASSWORD:
from_secret: registry-password
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_USERNAME:
from_secret: ssh-username
- name: scp
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
settings:
command_timeout: 2m
source:
- .
target: /stack/drone
- name: wait
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
commands:
- sleep 15
- name: "dockerbuild:"
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
commands:
- set -e
- sh .drone/login.sh
- sh .drone/build.sh
- sh .drone/push.sh
- sh .drone/logout.sh
environment:
REGISTRY_DOMAIN:
from_secret: registry-domain
REGISTRY_PASSWORD:
from_secret: registry-password
REGISTRY_PORT:
from_secret: registry-port
volumes:
- name: dockersock
path: /var/run
- name: deploy
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
settings:
envs:
- drone_tag
- drone_commit
- drone_build_number
- drone_repo_name
- drone_repo_namespace
- domain
- drone_gitea_client_id
- drone_gitea_server
- drone_server_host
- ssh_host
- ssh_username
- ssh_port
- drone_gitea_client_secret
- drone_rpc_secret
- ssh_key
- registry_domain
- registry_port
- registry_password
script:
- export DRONE_GITEA_CLIENT_SECRET=$${DRONE_GITEA_CLIENT_SECRET}
- export DRONE_RPC_SECRET=$${DRONE_RPC_SECRET}
- export SSH_KEY=$${SSH_KEY}
- export DOMAIN=$${DOMAIN}
- export DRONE_GITEA_CLIENT_ID=$${DRONE_GITEA_CLIENT_ID}
- export DRONE_GITEA_SERVER=$${DRONE_GITEA_SERVER}
- export DRONE_SERVER_HOST=$${DRONE_SERVER_HOST}
- export SSH_HOST=$${SSH_HOST}
- export SSH_USERNAME=$${SSH_USERNAME}
- export SSH_PORT=$${SSH_PORT}
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
- export REGISTRY_PORT=$${REGISTRY_PORT}
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
- set -e
- cd /stack/drone
- sh .drone/login.sh
- sh .drone/pull.sh
- sh .drone/deploy.sh
environment:
DOMAIN:
from_secret: domain
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
REGISTRY_DOMAIN:
from_secret: registry-domain
REGISTRY_PASSWORD:
from_secret: registry-password
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_USERNAME:
from_secret: ssh-username
services:
- name: docker
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
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
...

View File

@ -4,6 +4,6 @@
'drone-gitea-server',
'drone-server-host',
'ssh-host',
'ssh-user',
'ssh-username',
'ssh-port'
]

View File

@ -46,7 +46,7 @@ services:
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET}
- DRONE_RUNNER_CAPACITY=8
- DRONE_RUNNER_NAME="docker-runner"
- DRONE_RUNNER_ENVIRON=DOMAIN:$DOMAIN,REGISTRY_DOMAIN:$REGISTRY_DOMAIN,REGISTRY_PORT:$REGISTRY_PORT,REGISTRY_PASSWORD:$REGISTRY_PASSWORD,SSH_HOST:$SSH_HOST,SSH_PORT:$SSH_PORT,SSH_USER:$SSH_USER,SSH_KEY:$SSH_KEY
- DRONE_RUNNER_ENVIRON=DOMAIN:$DOMAIN,REGISTRY_DOMAIN:$REGISTRY_DOMAIN,REGISTRY_PORT:$REGISTRY_PORT,REGISTRY_PASSWORD:$REGISTRY_PASSWORD,SSH_HOST:$SSH_HOST,SSH_PORT:$SSH_PORT,SSH_USERNAME:$SSH_USERNAME,SSH_KEY:$SSH_KEY
networks:
- appnet
volumes:

3
git-hooks/build.sh Normal file
View File

@ -0,0 +1,3 @@
drone jsonnet --source .drone/$1.jsonnet --target .drone/$1.yml --stream \
&& git add .drone/$1.yml \
&& echo .drone/$1.yml \

View File

@ -1,3 +1,3 @@
drone jsonnet --source .drone/drone-home.jsonnet --target .drone/drone-home.yml --stream \
&& git add .drone/drone-home.yml \
sh git-hooks/build.sh drone \
&& sh git-hooks/build.sh drone-home \
&& echo "jsonnet built"