Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Giles Bradshaw | c7cd0196aa | |
Giles Bradshaw | 7b188ff0ee | |
Giles Bradshaw | 05b836e230 | |
Giles Bradshaw | 8f4080f8a2 | |
Giles Bradshaw | e369cbb235 | |
Giles Bradshaw | 80f11d1968 | |
Giles Bradshaw | f01185276f |
|
@ -1,4 +1,4 @@
|
||||||
export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/
|
export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/
|
||||||
docker stack rm drone \
|
docker stack rm drone \
|
||||||
&& echo 'sleeping...zzz' \
|
&& echo 'sleeping...zzz' \
|
||||||
&& sleep 60 \
|
&& sleep 60 \
|
||||||
|
|
|
@ -5,34 +5,54 @@ local publicSecrets = import 'lib/public-secrets.libsonnet';
|
||||||
local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
|
local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
|
||||||
local register = import 'node_modules/@sigyl/jsonnet-drone/register.libsonnet';
|
local register = import 'node_modules/@sigyl/jsonnet-drone/register.libsonnet';
|
||||||
local registry = import 'node_modules/@sigyl/jsonnet-drone/registry.libsonnet';
|
local registry = import 'node_modules/@sigyl/jsonnet-drone/registry.libsonnet';
|
||||||
|
local save = import 'node_modules/@sigyl/jsonnet-drone/save.libsonnet';
|
||||||
|
local build = import 'node_modules/@sigyl/jsonnet-drone/build.libsonnet';
|
||||||
|
local print = import 'node_modules/@sigyl/jsonnet-drone/print.libsonnet';
|
||||||
|
local droneImages = import 'node_modules/@sigyl/jsonnet-drone/drone-images.libsonnet';
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
registry: '',
|
registry: '',
|
||||||
|
name: 'drone',
|
||||||
|
root: 'stack'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
local defs = [
|
||||||
|
{
|
||||||
|
load: 'drone/drone:2.4.0@sha256:8c1c83ed0f68b00e16ca50b8769e6cf7ccb3c5ff390036eaec7e5fcb79c3cb92',
|
||||||
|
save: 'drone/drone:2.4.0'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
load: 'drone/drone-runner-docker:1.6.3@sha256:0d6069fcb7a437d4526cca760e15d57e00ba3e7954a3fffd72b04e716a23312c',
|
||||||
|
save: 'drone/drone-runner-docker:1.6.3'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
[
|
[
|
||||||
register,
|
register,
|
||||||
registry(
|
registry(
|
||||||
config {
|
config {
|
||||||
script: 'sh .drone/scripts/initialise-images.sh',
|
|
||||||
secrets: [
|
secrets: [
|
||||||
'REGISTRY_DOMAIN',
|
'REGISTRY_DOMAIN',
|
||||||
'REGISTRY_PORT',
|
'REGISTRY_PORT',
|
||||||
'REGISTRY_PASSWORD'
|
'REGISTRY_PASSWORD'
|
||||||
],
|
],
|
||||||
|
images: defs,
|
||||||
},
|
},
|
||||||
) {
|
),
|
||||||
trigger +: {
|
save(config)(
|
||||||
event +: [
|
defs,
|
||||||
'promote',
|
[],
|
||||||
],
|
),
|
||||||
target +: [
|
print(config)(
|
||||||
'registry',
|
[],
|
||||||
],
|
publicSecrets,
|
||||||
},
|
secretSecrets,
|
||||||
},
|
),
|
||||||
|
build(config)(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
droneImages(config),
|
||||||
deploy(config)(
|
deploy(config)(
|
||||||
'drone',
|
|
||||||
'/stack/',
|
|
||||||
[
|
[
|
||||||
'REGISTRY_DOMAIN',
|
'REGISTRY_DOMAIN',
|
||||||
'REGISTRY_PORT',
|
'REGISTRY_PORT',
|
||||||
|
|
|
@ -24,13 +24,33 @@ platform:
|
||||||
os: linux
|
os: linux
|
||||||
arch: amd64
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "dockerpull and save docker images:"
|
- name: drone/drone:2.4.0
|
||||||
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
commands:
|
commands:
|
||||||
- set -e
|
- set -e
|
||||||
- export REGISTRY=$${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
- sh .drone/scripts/initialise-images.sh $${REGISTRY} "$${REGISTRY_PASSWORD}"
|
- "n=0\nwhile :\ndo\n docker pull drone/drone:2.4.0@sha256:8c1c83ed0f68b00e16ca50b8769e6cf7ccb3c5ff390036eaec7e5fcb79c3cb92 \\\\\n && docker tag drone/drone:2.4.0@sha256:8c1c83ed0f68b00e16ca50b8769e6cf7ccb3c5ff390036eaec7e5fcb79c3cb92 $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone:2.4.0 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone:2.4.0 && break\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"initialise failed\"\n exit 1\n fi\n echo \"retrying..$n\"\n sleep 5\ndone\n"
|
||||||
|
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: drone/drone-runner-docker:1.6.3
|
||||||
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
|
commands:
|
||||||
|
- set -e
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- "n=0\nwhile :\ndo\n docker pull drone/drone-runner-docker:1.6.3@sha256:0d6069fcb7a437d4526cca760e15d57e00ba3e7954a3fffd72b04e716a23312c \\\\\n && docker tag drone/drone-runner-docker:1.6.3@sha256:0d6069fcb7a437d4526cca760e15d57e00ba3e7954a3fffd72b04e716a23312c $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone-runner-docker:1.6.3 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone-runner-docker:1.6.3 && break\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"initialise failed\"\n exit 1\n fi\n echo \"retrying..$n\"\n sleep 5\ndone\n"
|
||||||
environment:
|
environment:
|
||||||
REGISTRY_DOMAIN:
|
REGISTRY_DOMAIN:
|
||||||
from_secret: registry-domain
|
from_secret: registry-domain
|
||||||
|
@ -76,7 +96,80 @@ trigger:
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: deploy
|
name: save
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: mkdir
|
||||||
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
|
settings:
|
||||||
|
envs:
|
||||||
|
- drone_tag
|
||||||
|
- drone_commit
|
||||||
|
- drone_build_number
|
||||||
|
- drone_repo_name
|
||||||
|
- drone_repo_namespace
|
||||||
|
script:
|
||||||
|
- mkdir -p /stack/.images/drone/built
|
||||||
|
- rm -f /stack/.images/drone/*.*
|
||||||
|
- rm -f /stack/.images/drone/built/*.*
|
||||||
|
|
||||||
|
- name: drone/drone:2.4.0
|
||||||
|
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
|
||||||
|
- destination_registry
|
||||||
|
script:
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone:2.4.0
|
||||||
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone:2.4.0 -o /stack/.images/drone/drone_drone:2.4.0.tar
|
||||||
|
- echo "docker load < drone_drone:2.4.0.tar" >> /stack/.images/drone/load.sh
|
||||||
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone:2.4.0 $${DESTINATION_REGISTRY}/stack/drone/drone/drone:2.4.0" >> /stack/.images/drone/load.sh
|
||||||
|
|
||||||
|
- name: drone/drone-runner-docker:1.6.3
|
||||||
|
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
|
||||||
|
- destination_registry
|
||||||
|
script:
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone-runner-docker:1.6.3
|
||||||
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone-runner-docker:1.6.3 -o /stack/.images/drone/drone_drone-runner-docker:1.6.3.tar
|
||||||
|
- echo "docker load < drone_drone-runner-docker:1.6.3.tar" >> /stack/.images/drone/load.sh
|
||||||
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone-runner-docker:1.6.3 $${DESTINATION_REGISTRY}/stack/drone/drone/drone-runner-docker:1.6.3" >> /stack/.images/drone/load.sh
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- save
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: print
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
os: linux
|
os: linux
|
||||||
|
@ -92,12 +185,10 @@ steps:
|
||||||
- drone_build_number
|
- drone_build_number
|
||||||
- drone_repo_name
|
- drone_repo_name
|
||||||
- drone_repo_namespace
|
- drone_repo_namespace
|
||||||
- registry_domain
|
|
||||||
- registry_port
|
|
||||||
- registry_password
|
|
||||||
- scheme
|
|
||||||
- scheme
|
- scheme
|
||||||
- domain
|
- domain
|
||||||
|
- registry_domain
|
||||||
|
- registry_port
|
||||||
- drone_gitea_client_id
|
- drone_gitea_client_id
|
||||||
- drone_gitea_server
|
- drone_gitea_server
|
||||||
- drone_server_host
|
- drone_server_host
|
||||||
|
@ -107,14 +198,13 @@ steps:
|
||||||
- drone_gitea_client_secret
|
- drone_gitea_client_secret
|
||||||
- drone_rpc_secret
|
- drone_rpc_secret
|
||||||
- ssh_key
|
- ssh_key
|
||||||
|
- registry_password
|
||||||
script:
|
script:
|
||||||
- rm -f env-drone
|
- 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 SCHEME='$${SCHEME}'\" >> env-drone # \"scheme\""
|
|
||||||
- "echo \"export SCHEME='$${SCHEME}'\" >> env-drone # \"scheme\""
|
- "echo \"export SCHEME='$${SCHEME}'\" >> env-drone # \"scheme\""
|
||||||
- "echo \"export DOMAIN='$${DOMAIN}'\" >> env-drone # \"domain\""
|
- "echo \"export DOMAIN='$${DOMAIN}'\" >> env-drone # \"domain\""
|
||||||
|
- "echo \"export REGISTRY_DOMAIN='$${REGISTRY_DOMAIN}'\" >> env-drone # \"registry-domain\""
|
||||||
|
- "echo \"export REGISTRY_PORT='$${REGISTRY_PORT}'\" >> env-drone # \"registry-port\""
|
||||||
- "echo \"export DRONE_GITEA_CLIENT_ID='$${DRONE_GITEA_CLIENT_ID}'\" >> env-drone # \"drone-gitea-client-id\""
|
- "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_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 DRONE_SERVER_HOST='$${DRONE_SERVER_HOST}'\" >> env-drone # \"drone-server-host\""
|
||||||
|
@ -124,6 +214,7 @@ steps:
|
||||||
- "echo \"export DRONE_GITEA_CLIENT_SECRET='$${DRONE_GITEA_CLIENT_SECRET}'\" >> env-drone # \"drone-gitea-client-secret\""
|
- "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 DRONE_RPC_SECRET='$${DRONE_RPC_SECRET}'\" >> env-drone # \"drone-rpc-secret\""
|
||||||
- "echo \"export SSH_KEY='$${SSH_KEY}'\" >> env-drone # \"ssh-key\""
|
- "echo \"export SSH_KEY='$${SSH_KEY}'\" >> env-drone # \"ssh-key\""
|
||||||
|
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-drone # \"registry-password\""
|
||||||
environment:
|
environment:
|
||||||
DOMAIN:
|
DOMAIN:
|
||||||
from_secret: domain
|
from_secret: domain
|
||||||
|
@ -154,6 +245,156 @@ steps:
|
||||||
SSH_USERNAME:
|
SSH_USERNAME:
|
||||||
from_secret: ssh-username
|
from_secret: ssh-username
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- print
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: build
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "dockerbuild:"
|
||||||
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
|
commands:
|
||||||
|
- set -e
|
||||||
|
- export NAME=drone
|
||||||
|
- export ROOT=stack
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- sh .drone/build.sh
|
||||||
|
- sh .drone/push.sh
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
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
|
||||||
|
- name: daemonjson
|
||||||
|
path: /etc/docker/daemon.json
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
temp: {}
|
||||||
|
- name: ca
|
||||||
|
host:
|
||||||
|
path: /etc/docker/certs.d
|
||||||
|
- name: daemonjson
|
||||||
|
host:
|
||||||
|
path: /etc/docker/daemon.json
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- build
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: drone-images
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: mkdir
|
||||||
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
|
settings:
|
||||||
|
envs:
|
||||||
|
- drone_tag
|
||||||
|
- drone_commit
|
||||||
|
- drone_build_number
|
||||||
|
- drone_repo_name
|
||||||
|
- drone_repo_namespace
|
||||||
|
script:
|
||||||
|
- mkdir -p /stack/.images/drone/drone-images
|
||||||
|
- rm -f /stack/.images/drone/drone-images/*.*
|
||||||
|
|
||||||
|
- name: docker
|
||||||
|
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
|
||||||
|
script:
|
||||||
|
- docker pull docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
|
- docker save docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f -o /stack/.images/drone/drone-images/docker.tar
|
||||||
|
- echo "docker load docker.tar" >> /stack/.images/drone/drone-images/load.sh
|
||||||
|
|
||||||
|
- name: scp
|
||||||
|
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
|
||||||
|
script:
|
||||||
|
- docker pull appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
||||||
|
- docker save appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47 -o /stack/.images/drone/drone-images/scp.tar
|
||||||
|
- echo "docker load scp.tar" >> /stack/.images/drone/drone-images/load.sh
|
||||||
|
|
||||||
|
- name: ssh
|
||||||
|
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
|
||||||
|
script:
|
||||||
|
- docker pull appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
|
- docker save appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea -o /stack/.images/drone/drone-images/ssh.tar
|
||||||
|
- echo "docker load ssh.tar" >> /stack/.images/drone/drone-images/load.sh
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- drone-images
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: deploy
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
- name: scp
|
- name: scp
|
||||||
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
||||||
settings:
|
settings:
|
||||||
|
@ -162,32 +403,6 @@ steps:
|
||||||
- .
|
- .
|
||||||
target: /stack/drone
|
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
|
|
||||||
SCHEME:
|
|
||||||
from_secret: scheme
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run
|
|
||||||
|
|
||||||
- name: deploy
|
- name: deploy
|
||||||
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
settings:
|
settings:
|
||||||
|
@ -199,6 +414,8 @@ steps:
|
||||||
- drone_repo_namespace
|
- drone_repo_namespace
|
||||||
- scheme
|
- scheme
|
||||||
- domain
|
- domain
|
||||||
|
- registry_domain
|
||||||
|
- registry_port
|
||||||
- drone_gitea_client_id
|
- drone_gitea_client_id
|
||||||
- drone_gitea_server
|
- drone_gitea_server
|
||||||
- drone_server_host
|
- drone_server_host
|
||||||
|
@ -208,6 +425,7 @@ steps:
|
||||||
- drone_gitea_client_secret
|
- drone_gitea_client_secret
|
||||||
- drone_rpc_secret
|
- drone_rpc_secret
|
||||||
- ssh_key
|
- ssh_key
|
||||||
|
- registry_password
|
||||||
- registry_domain
|
- registry_domain
|
||||||
- registry_port
|
- registry_port
|
||||||
- registry_password
|
- registry_password
|
||||||
|
@ -216,8 +434,11 @@ steps:
|
||||||
- export DRONE_GITEA_CLIENT_SECRET=$${DRONE_GITEA_CLIENT_SECRET}
|
- export DRONE_GITEA_CLIENT_SECRET=$${DRONE_GITEA_CLIENT_SECRET}
|
||||||
- export DRONE_RPC_SECRET=$${DRONE_RPC_SECRET}
|
- export DRONE_RPC_SECRET=$${DRONE_RPC_SECRET}
|
||||||
- export SSH_KEY=$${SSH_KEY}
|
- export SSH_KEY=$${SSH_KEY}
|
||||||
|
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
||||||
- export SCHEME=$${SCHEME}
|
- export SCHEME=$${SCHEME}
|
||||||
- export DOMAIN=$${DOMAIN}
|
- export DOMAIN=$${DOMAIN}
|
||||||
|
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
|
||||||
|
- export REGISTRY_PORT=$${REGISTRY_PORT}
|
||||||
- export DRONE_GITEA_CLIENT_ID=$${DRONE_GITEA_CLIENT_ID}
|
- export DRONE_GITEA_CLIENT_ID=$${DRONE_GITEA_CLIENT_ID}
|
||||||
- export DRONE_GITEA_SERVER=$${DRONE_GITEA_SERVER}
|
- export DRONE_GITEA_SERVER=$${DRONE_GITEA_SERVER}
|
||||||
- export DRONE_SERVER_HOST=$${DRONE_SERVER_HOST}
|
- export DRONE_SERVER_HOST=$${DRONE_SERVER_HOST}
|
||||||
|
@ -229,8 +450,10 @@ steps:
|
||||||
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
||||||
- export SCHEME=$${SCHEME}
|
- export SCHEME=$${SCHEME}
|
||||||
- set -e
|
- set -e
|
||||||
|
- export NAME=drone
|
||||||
|
- export ROOT=stack
|
||||||
- cd /stack/drone
|
- cd /stack/drone
|
||||||
- sh .drone/login.sh
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
- sh .drone/pull.sh
|
- sh .drone/pull.sh
|
||||||
- sh .drone/deploy.sh
|
- sh .drone/deploy.sh
|
||||||
environment:
|
environment:
|
||||||
|
@ -263,32 +486,12 @@ steps:
|
||||||
SSH_USERNAME:
|
SSH_USERNAME:
|
||||||
from_secret: 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
|
|
||||||
- name: daemonjson
|
|
||||||
path: /etc/docker/daemon.json
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
temp: {}
|
|
||||||
- name: ca
|
|
||||||
host:
|
|
||||||
path: /etc/docker/certs.d
|
|
||||||
- name: daemonjson
|
|
||||||
host:
|
|
||||||
path: /etc/docker/daemon.json
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- promote
|
- promote
|
||||||
|
- promote
|
||||||
target:
|
target:
|
||||||
|
- deploy
|
||||||
- production
|
- production
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
[
|
[
|
||||||
'scheme',
|
'scheme',
|
||||||
'domain',
|
'domain',
|
||||||
|
'registry-domain',
|
||||||
|
'registry-port',
|
||||||
'drone-gitea-client-id',
|
'drone-gitea-client-id',
|
||||||
'drone-gitea-server',
|
'drone-gitea-server',
|
||||||
'drone-server-host',
|
'drone-server-host',
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
[
|
[
|
||||||
'drone-gitea-client-secret',
|
'drone-gitea-client-secret',
|
||||||
'drone-rpc-secret',
|
'drone-rpc-secret',
|
||||||
'ssh-key'
|
'ssh-key',
|
||||||
|
'registry-password',
|
||||||
]
|
]
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
docker login ${REGISTRY_DOMAIN}:${REGISTRY_PORT} --username client --password "${REGISTRY_PASSWORD}"
|
|
|
@ -1 +0,0 @@
|
||||||
docker logout ${REGISTRY_DOMAIN}:${REGISTRY_PORT}
|
|
|
@ -4,6 +4,6 @@
|
||||||
"build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream"
|
"build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sigyl/jsonnet-drone": "0.4.1"
|
"@sigyl/jsonnet-drone": "^1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
n=0
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
docker pull $2 \
|
|
||||||
&& docker tag $2 $1$2 \
|
|
||||||
&& docker push $1$2 && break # substitute your command here
|
|
||||||
n=$((n+1))
|
|
||||||
if [ $n -ge 10 ]; then
|
|
||||||
echo "initialise failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "retrying..$n"
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
sh $(dirname $0)/login.sh $1 "$2" \
|
|
||||||
&& sh $(dirname $0)/initialise-image.sh $1 drone/drone:1.9.1 \
|
|
||||||
&& sh $(dirname $0)/initialise-image.sh $1 drone/drone-runner-docker:1.5.3
|
|
|
@ -1,14 +0,0 @@
|
||||||
n=0
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
docker login $1 --username client --password "$2" \
|
|
||||||
&& break # substitute your command here
|
|
||||||
n=$((n+1))
|
|
||||||
|
|
||||||
if [ $n -ge 10 ]; then
|
|
||||||
echo "login failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "retrying login..$n"
|
|
||||||
sleep 5
|
|
||||||
done
|
|
|
@ -12,10 +12,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff"
|
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff"
|
||||||
integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw==
|
integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw==
|
||||||
|
|
||||||
"@sigyl/jsonnet-drone@0.4.1":
|
"@sigyl/jsonnet-drone@^1.0.0":
|
||||||
version "0.4.1"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.4.1.tgz#3527edb00f8bb860de1658f4c9fa6f81f932d3b7"
|
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-1.0.0.tgz#943bd8a1abc8a916026944816709f5ed1d8e7ef8"
|
||||||
integrity sha512-+TOx51KJG1RxrPRZ2lPpia7a6Ms5UvkyLIuXuumPtenyxJ/pivY1TdcLvSAvFgVZHMjh9CxBCuOu8vNT1fPy2A==
|
integrity sha512-ubyVC1/nAM584wTnnRBZTOP18z28Yy7SRApvSuo/3y2arngKlNI1FwOzKTFt/7L9+rNy19dRO/g0obEkyR3KmA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@sigyl/jsonnet-compose" "^0.0.2"
|
"@sigyl/jsonnet-compose" "^0.0.2"
|
||||||
"@sigyl/jsonnet-drone-environment" "0.0.5"
|
"@sigyl/jsonnet-drone-environment" "0.0.5"
|
||||||
|
|
|
@ -8,7 +8,7 @@ services:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
image: ${LOCAL_DOCKER_REGISTRY}drone/drone:1.9.1
|
image: ${LOCAL_DOCKER_REGISTRY}drone/drone:2.4.0
|
||||||
volumes:
|
volumes:
|
||||||
- drone-5:/var/lib/drone
|
- drone-5:/var/lib/drone
|
||||||
- drone-data-5:/data
|
- drone-data-5:/data
|
||||||
|
@ -37,7 +37,7 @@ services:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
image: ${LOCAL_DOCKER_REGISTRY}drone/drone-runner-docker:1.5.3
|
image: ${LOCAL_DOCKER_REGISTRY}drone/drone-runner-docker:1.6.3
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in New Issue