feat: promotions
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
9fae5c7e98
commit
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 \
|
||||
&& echo 'sleeping...zzz' \
|
||||
&& sleep 60 \
|
||||
|
|
|
@ -5,34 +5,53 @@ 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';
|
||||
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 config = {
|
||||
registry: '',
|
||||
name: 'drone',
|
||||
root: 'stack'
|
||||
};
|
||||
|
||||
local defs = [
|
||||
{
|
||||
load: 'drone/drone:1.9.1@sha256:f07d1719b75a404c142b95b47598d7658805359d2416e8f36ddfc0385120e9a6',
|
||||
save: 'drone/drone:1.9.1'
|
||||
},
|
||||
{
|
||||
load: 'drone/drone-runner-docker:1.5.3@sha256:8554bbb53c482324f544091ec9b6e855e8581cb27cb9fbfb2c38fd4574dfcd8e',
|
||||
save: 'drone/drone-runner-docker:1.5.3'
|
||||
},
|
||||
];
|
||||
|
||||
[
|
||||
register,
|
||||
registry(
|
||||
config {
|
||||
script: 'sh .drone/scripts/initialise-images.sh',
|
||||
secrets: [
|
||||
'REGISTRY_DOMAIN',
|
||||
'REGISTRY_PORT',
|
||||
'REGISTRY_PASSWORD'
|
||||
],
|
||||
images: defs,
|
||||
},
|
||||
) {
|
||||
trigger +: {
|
||||
event +: [
|
||||
'promote',
|
||||
],
|
||||
target +: [
|
||||
'registry',
|
||||
],
|
||||
},
|
||||
},
|
||||
),
|
||||
save(config)(
|
||||
defs,
|
||||
[],
|
||||
),
|
||||
print(config)(
|
||||
[],
|
||||
publicSecrets,
|
||||
secretSecrets,
|
||||
),
|
||||
build(config)(
|
||||
[],
|
||||
),
|
||||
|
||||
deploy(config)(
|
||||
'drone',
|
||||
'/stack/',
|
||||
[
|
||||
'REGISTRY_DOMAIN',
|
||||
'REGISTRY_PORT',
|
||||
|
|
|
@ -24,13 +24,33 @@ platform:
|
|||
os: linux
|
||||
arch: amd64
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
- name: "dockerpull and save docker images:"
|
||||
- name: drone/drone:1.9.1
|
||||
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||
commands:
|
||||
- set -e
|
||||
- export REGISTRY=$${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/
|
||||
- sh .drone/scripts/initialise-images.sh $${REGISTRY} "$${REGISTRY_PASSWORD}"
|
||||
- "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:1.9.1@sha256:f07d1719b75a404c142b95b47598d7658805359d2416e8f36ddfc0385120e9a6 \\\\\n && docker tag drone/drone:1.9.1@sha256:f07d1719b75a404c142b95b47598d7658805359d2416e8f36ddfc0385120e9a6 $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone:1.9.1 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone:1.9.1 && 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.5.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.5.3@sha256:8554bbb53c482324f544091ec9b6e855e8581cb27cb9fbfb2c38fd4574dfcd8e \\\\\n && docker tag drone/drone-runner-docker:1.5.3@sha256:8554bbb53c482324f544091ec9b6e855e8581cb27cb9fbfb2c38fd4574dfcd8e $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone-runner-docker:1.5.3 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone-runner-docker:1.5.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:
|
||||
REGISTRY_DOMAIN:
|
||||
from_secret: registry-domain
|
||||
|
@ -76,7 +96,78 @@ trigger:
|
|||
---
|
||||
kind: pipeline
|
||||
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:1.9.1
|
||||
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:
|
||||
- "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:1.9.1
|
||||
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone:1.9.1 -o /stack/.images/drone/drone_drone:1.9.1.tar
|
||||
- echo "docker load drone_drone:1.9.1.tar" >> /stack/.images/drone/load.sh
|
||||
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone:1.9.1 /stack/DOLLAR1/drone/drone:1.9.1" >> /stack/.images/drone/load.sh
|
||||
|
||||
- name: drone/drone-runner-docker:1.5.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
|
||||
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.5.3
|
||||
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone-runner-docker:1.5.3 -o /stack/.images/drone/drone_drone-runner-docker:1.5.3.tar
|
||||
- echo "docker load drone_drone-runner-docker:1.5.3.tar" >> /stack/.images/drone/load.sh
|
||||
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/drone/drone/drone-runner-docker:1.5.3 /stack/DOLLAR1/drone/drone-runner-docker:1.5.3" >> /stack/.images/drone/load.sh
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- promote
|
||||
target:
|
||||
- save
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: print
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
|
@ -92,10 +183,6 @@ steps:
|
|||
- drone_build_number
|
||||
- drone_repo_name
|
||||
- drone_repo_namespace
|
||||
- registry_domain
|
||||
- registry_port
|
||||
- registry_password
|
||||
- scheme
|
||||
- scheme
|
||||
- domain
|
||||
- drone_gitea_client_id
|
||||
|
@ -109,10 +196,6 @@ steps:
|
|||
- 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 SCHEME='$${SCHEME}'\" >> env-drone # \"scheme\""
|
||||
- "echo \"export SCHEME='$${SCHEME}'\" >> env-drone # \"scheme\""
|
||||
- "echo \"export DOMAIN='$${DOMAIN}'\" >> env-drone # \"domain\""
|
||||
- "echo \"export DRONE_GITEA_CLIENT_ID='$${DRONE_GITEA_CLIENT_ID}'\" >> env-drone # \"drone-gitea-client-id\""
|
||||
|
@ -137,12 +220,6 @@ steps:
|
|||
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
|
||||
SCHEME:
|
||||
from_secret: scheme
|
||||
SSH_HOST:
|
||||
|
@ -154,6 +231,73 @@ steps:
|
|||
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: deploy
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: scp
|
||||
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
||||
settings:
|
||||
|
@ -162,32 +306,6 @@ steps:
|
|||
- .
|
||||
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
|
||||
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||
settings:
|
||||
|
@ -229,8 +347,10 @@ steps:
|
|||
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
||||
- export SCHEME=$${SCHEME}
|
||||
- set -e
|
||||
- export NAME=drone
|
||||
- export ROOT=stack
|
||||
- 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/deploy.sh
|
||||
environment:
|
||||
|
@ -263,32 +383,12 @@ steps:
|
|||
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:
|
||||
event:
|
||||
- promote
|
||||
- promote
|
||||
target:
|
||||
- deploy
|
||||
- production
|
||||
|
||||
...
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sigyl/jsonnet-drone": "0.4.1"
|
||||
"@sigyl/jsonnet-drone": "^0.4.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw==
|
||||
|
||||
"@sigyl/jsonnet-drone@0.4.1":
|
||||
version "0.4.1"
|
||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.4.1.tgz#3527edb00f8bb860de1658f4c9fa6f81f932d3b7"
|
||||
integrity sha512-+TOx51KJG1RxrPRZ2lPpia7a6Ms5UvkyLIuXuumPtenyxJ/pivY1TdcLvSAvFgVZHMjh9CxBCuOu8vNT1fPy2A==
|
||||
"@sigyl/jsonnet-drone@^0.4.5":
|
||||
version "0.4.5"
|
||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.4.5.tgz#deb45b3fa837650d518b651044e993266c7386ac"
|
||||
integrity sha512-s7/QHlT4YydwDPz/puR4iy7rcTl5vqR4YQmqlXCMA7VlcYPT4tC3GOb38njwZfNN4mxNa6oDKaM6eZEJX4SpiQ==
|
||||
dependencies:
|
||||
"@sigyl/jsonnet-compose" "^0.0.2"
|
||||
"@sigyl/jsonnet-drone-environment" "0.0.5"
|
||||
|
|
Loading…
Reference in New Issue