This commit is contained in:
parent
7af5ca6838
commit
e9f8d8f2d0
|
@ -5,31 +5,47 @@ 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 config = {
|
local config = {
|
||||||
registry: '',
|
registry: '',
|
||||||
|
name: 'gitea',
|
||||||
|
root: 'stack',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
local defs = [
|
||||||
|
{
|
||||||
|
load: 'gitea/gitea:1.12.3-linux-amd64@sha256:38b8222941d8acffb7bb9c3fb0e9e0b657e06815a090f1fb11ed6900a3c9f384',
|
||||||
|
save: 'gitea/gitea:1.12.3-linux-amd64'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
register,
|
register,
|
||||||
registry(
|
registry(
|
||||||
config {
|
config {
|
||||||
script: 'sh .drone/scripts/initialise-images.sh',
|
|
||||||
secrets: [],
|
secrets: [],
|
||||||
|
images: defs,
|
||||||
},
|
},
|
||||||
) {
|
),
|
||||||
trigger +: {
|
save(config)(
|
||||||
event +: [
|
defs,
|
||||||
'promote',
|
[
|
||||||
],
|
|
||||||
target +: [
|
|
||||||
'registry',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
deploy(config)(
|
|
||||||
'gitea',
|
'gitea',
|
||||||
'/stack/',
|
],
|
||||||
|
),
|
||||||
|
print(config)(
|
||||||
|
[],
|
||||||
|
publicSecrets,
|
||||||
|
secretSecrets,
|
||||||
|
),
|
||||||
|
build(config)(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
deploy(config)(
|
||||||
[],
|
[],
|
||||||
publicSecrets,
|
publicSecrets,
|
||||||
secretSecrets,
|
secretSecrets,
|
||||||
|
@ -40,14 +56,5 @@ local config = {
|
||||||
'REGISTRY_PORT',
|
'REGISTRY_PORT',
|
||||||
'REGISTRY_PASSWORD',
|
'REGISTRY_PASSWORD',
|
||||||
],
|
],
|
||||||
) {
|
),
|
||||||
trigger +: {
|
|
||||||
event +: [
|
|
||||||
'promote',
|
|
||||||
],
|
|
||||||
target +: [
|
|
||||||
'production',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -24,13 +24,16 @@ platform:
|
||||||
os: linux
|
os: linux
|
||||||
arch: amd64
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "dockerpull and save docker images:"
|
- name: gitea/gitea:1.12.3-linux-amd64@sha256:38b8222941d8acffb7bb9c3fb0e9e0b657e06815a090f1fb11ed6900a3c9f384
|
||||||
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 gitea/gitea:1.12.3-linux-amd64@sha256:38b8222941d8acffb7bb9c3fb0e9e0b657e06815a090f1fb11ed6900a3c9f384 \\\\\n && docker tag gitea/gitea:1.12.3-linux-amd64@sha256:38b8222941d8acffb7bb9c3fb0e9e0b657e06815a090f1fb11ed6900a3c9f384 $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea/gitea:1.12.3-linux-amd64 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea/gitea:1.12.3-linux-amd64 && 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"
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
|
@ -69,7 +72,78 @@ 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/gitea/built
|
||||||
|
- rm -f /stack/.images/gitea/*.*
|
||||||
|
- rm -f /stack/.images/gitea/built/*.*
|
||||||
|
|
||||||
|
- name: gitea/gitea:1.12.3-linux-amd64
|
||||||
|
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/gitea/gitea/gitea:1.12.3-linux-amd64
|
||||||
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea/gitea:1.12.3-linux-amd64 -o /stack/.images/gitea/gitea_gitea:1.12.3-linux-amd64.tar
|
||||||
|
- echo "docker load gitea_gitea:1.12.3-linux-amd64.tar" >> /stack/.images/gitea/load.sh
|
||||||
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea/gitea:1.12.3-linux-amd64 /stack/DOLLAR1/gitea/gitea:1.12.3-linux-amd64" >> /stack/.images/gitea/load.sh
|
||||||
|
|
||||||
|
- name: gitea
|
||||||
|
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/gitea/gitea
|
||||||
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea -o /stack/.images/gitea/built/gitea.tar
|
||||||
|
- echo "docker load gitea.tar" >> /stack/.images/gitea/built/load.sh
|
||||||
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea /stack/DOLLAR1/gitea" >> /stack/.images/gitea/built/load.sh
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- sve
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: print
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
os: linux
|
os: linux
|
||||||
|
@ -125,6 +199,67 @@ steps:
|
||||||
GITEA_SERVER_LFS_JWT_SECRET:
|
GITEA_SERVER_LFS_JWT_SECRET:
|
||||||
from_secret: gitea-server-lfs-jwt-secret
|
from_secret: gitea-server-lfs-jwt-secret
|
||||||
|
|
||||||
|
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=gitea
|
||||||
|
- 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
|
||||||
|
|
||||||
|
---
|
||||||
|
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:
|
||||||
|
@ -133,23 +268,6 @@ steps:
|
||||||
- .
|
- .
|
||||||
target: /stack/gitea
|
target: /stack/gitea
|
||||||
|
|
||||||
- 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
|
|
||||||
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:
|
||||||
|
@ -189,8 +307,10 @@ steps:
|
||||||
- export REGISTRY_PORT=$${REGISTRY_PORT}
|
- export REGISTRY_PORT=$${REGISTRY_PORT}
|
||||||
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
||||||
- set -e
|
- set -e
|
||||||
|
- export NAME=gitea
|
||||||
|
- export ROOT=stack
|
||||||
- cd /stack/gitea
|
- cd /stack/gitea
|
||||||
- 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:
|
||||||
|
@ -213,32 +333,10 @@ steps:
|
||||||
GITEA_SERVER_LFS_JWT_SECRET:
|
GITEA_SERVER_LFS_JWT_SECRET:
|
||||||
from_secret: gitea-server-lfs-jwt-secret
|
from_secret: gitea-server-lfs-jwt-secret
|
||||||
|
|
||||||
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
|
||||||
target:
|
target:
|
||||||
- production
|
- deploy
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
|
@ -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": "^0.4.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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@^0.4.2":
|
||||||
version "0.4.1"
|
version "0.4.2"
|
||||||
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-0.4.2.tgz#8b34bae3a1a560414df5e3ecdf49c8f73c78771b"
|
||||||
integrity sha512-+TOx51KJG1RxrPRZ2lPpia7a6Ms5UvkyLIuXuumPtenyxJ/pivY1TdcLvSAvFgVZHMjh9CxBCuOu8vNT1fPy2A==
|
integrity sha512-WBydSUcPkGtVQBzn6UmXiMcHPYow5/B0OFTpGdCD7h6EqUkvfJON+79NpXo7FOAt0PD2EQJzUVAkUBoMiUgfgw==
|
||||||
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"
|
||||||
|
|
Loading…
Reference in New Issue