Compare commits

..

24 Commits

Author SHA1 Message Date
giles b9d46ec004 .
continuous-integration/drone/push Build is passing Details
2022-06-08 19:13:56 +01:00
giles 3b6c1749fa . 2022-06-08 19:05:00 +01:00
giles 088aba5587 . 2022-06-08 18:44:28 +01:00
giles f150903ca2 . 2022-06-08 18:39:19 +01:00
giles 88c6d9fbd3 . 2022-06-08 18:35:57 +01:00
giles c6340451c8 . 2022-06-08 18:16:09 +01:00
giles 9cfb962f52 . 2022-06-08 17:39:22 +01:00
giles eb09ddf03f . 2022-06-08 17:05:59 +01:00
giles 97158883f9 . 2022-06-08 16:54:04 +01:00
giles cd17876c94 . 2022-06-08 16:35:13 +01:00
giles dd7b63dd9b . 2022-06-08 16:18:52 +01:00
giles 734166d9f0 . 2022-06-08 16:16:30 +01:00
giles 05a934d88b . 2022-06-08 16:14:33 +01:00
giles 0c8b859444 . 2022-06-08 15:09:40 +01:00
giles 55c7291ef2 . 2022-06-08 15:06:51 +01:00
giles 47e6ea9472 . 2022-06-08 14:22:27 +01:00
giles cc64869c75 . 2022-06-08 14:21:34 +01:00
giles 70c3310f05 . 2022-06-08 14:16:14 +01:00
giles fa40bfcb42 . 2022-06-08 14:13:39 +01:00
giles f3a6fa1453 . 2022-06-08 13:00:46 +01:00
giles 4f61ffd783 . 2022-06-08 12:57:44 +01:00
giles 4869e2570a . 2022-06-08 12:52:31 +01:00
giles 33972dcd6b . 2022-06-08 10:31:46 +01:00
giles 40856ee0f7 .
continuous-integration/drone/push Build is passing Details
2022-06-07 17:02:54 +01:00
15 changed files with 606 additions and 321 deletions

View File

@ -1,5 +1,6 @@
sleep 10 sleep 10
docker build gitea \ docker build gitea \
--build-arg REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/ \ -t ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea
-t ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea:$1 #--build-arg REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/ \

View File

@ -1,7 +1,6 @@
export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/ \ echo $NAME \
&& echo $1 \ && export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/ \
&& export TAG=$1 \
&& docker stack rm gitea \ && docker stack rm gitea \
&& echo 'sleeping...zzz' \ && echo 'sleeping...zzz' \
&& sleep 60 \ && sleep 10 \
&& docker stack deploy -c docker-compose.yml gitea --with-registry-auth && docker stack deploy -c docker-compose.yml gitea --with-registry-auth

View File

@ -8,6 +8,7 @@ local registry = import 'node_modules/@sigyl/jsonnet-drone/registry.libsonnet';
local save = import 'node_modules/@sigyl/jsonnet-drone/save.libsonnet'; local save = import 'node_modules/@sigyl/jsonnet-drone/save.libsonnet';
local build = import 'node_modules/@sigyl/jsonnet-drone/build.libsonnet'; local build = import 'node_modules/@sigyl/jsonnet-drone/build.libsonnet';
local print = import 'node_modules/@sigyl/jsonnet-drone/print.libsonnet'; local print = import 'node_modules/@sigyl/jsonnet-drone/print.libsonnet';
local printSecrets = import 'node_modules/@sigyl/jsonnet-drone/print-secrets.libsonnet';
local config = { local config = {
registry: '', registry: '',
@ -42,6 +43,11 @@ local defs = [
publicSecrets, publicSecrets,
secretSecrets, secretSecrets,
), ),
printSecrets(config)(
[],
publicSecrets,
secretSecrets,
),
build(config)( build(config)(
[], [],
), ),

View File

@ -1,301 +1,547 @@
kind: pipeline
type: docker
name: print
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
- gitea_mailer_host
- gitea_mailer_from
- gitea_mailer_user
- gitea_app_name
- gitea_server_lfs_jwt_secret
- gitea_security_secret_key
- gitea_security_internal_token
- gitea_oauth2_jwt_secret
- gitea_mailer_passwd
- gitea_mailer_protocol
script:
- rm -f env-gitea
- "echo \"export GITEA_MAILER_HOST='$${GITEA_MAILER_HOST}'\" >> env-gitea # \"gitea-mailer-host\""
- "echo \"export GITEA_MAILER_FROM='$${GITEA_MAILER_FROM}'\" >> env-gitea # \"gitea-mailer-from\""
- "echo \"export GITEA_MAILER_USER='$${GITEA_MAILER_USER}'\" >> env-gitea # \"gitea-mailer-user\""
- "echo \"export GITEA_APP_NAME='$${GITEA_APP_NAME}'\" >> env-gitea # \"gitea-app-name\""
- "echo \"export GITEA_SERVER_LFS_JWT_SECRET='$${GITEA_SERVER_LFS_JWT_SECRET}'\" >> env-gitea # \"gitea-server-lfs-jwt-secret\""
- "echo \"export GITEA_SECURITY_SECRET_KEY='$${GITEA_SECURITY_SECRET_KEY}'\" >> env-gitea # \"gitea-security-secret-key\""
- "echo \"export GITEA_SECURITY_INTERNAL_TOKEN='$${GITEA_SECURITY_INTERNAL_TOKEN}'\" >> env-gitea # \"gitea-security-internal-token\""
- "echo \"export GITEA_OAUTH2_JWT_SECRET='$${GITEA_OAUTH2_JWT_SECRET}'\" >> env-gitea # \"gitea-oauth2-jwt-secret\""
- "echo \"export GITEA_MAILER_PASSWD='$${GITEA_MAILER_PASSWD}'\" >> env-gitea # \"gitea-mailer-passwd\""
- "echo \"export GITEA_MAILER_PROTOCOL='$${GITEA_MAILER_PROTOCOL}'\" >> env-gitea # \"gitea-mailer-protocol\""
environment:
GITEA_APP_NAME:
from_secret: gitea-app-name
GITEA_MAILER_FROM:
from_secret: gitea-mailer-from
GITEA_MAILER_HOST:
from_secret: gitea-mailer-host
GITEA_MAILER_PASSWD:
from_secret: gitea-mailer-passwd
GITEA_MAILER_PROTOCOL:
from_secret: gitea-mailer-protocol
GITEA_MAILER_USER:
from_secret: gitea-mailer-user
GITEA_OAUTH2_JWT_SECRET:
from_secret: gitea-oauth2-jwt-secret
GITEA_SECURITY_INTERNAL_TOKEN:
from_secret: gitea-security-internal-token
GITEA_SECURITY_SECRET_KEY:
from_secret: gitea-security-secret-key
GITEA_SERVER_LFS_JWT_SECRET:
from_secret: gitea-server-lfs-jwt-secret
trigger:
event:
- promote
target:
- print
--- ---
kind: pipeline {
type: docker "clone": {
name: build "disable": true
},
platform: "kind": "pipeline",
os: linux "name": "register",
arch: amd64 "trigger": {
"event": {
steps: "exclude": [
- name: "build commit" "promote"
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f ]
commands: }
- set -e },
- export NAME=gitea "type": "docker"
- 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 ${DRONE_COMMIT_SHA}
- sh .drone/push.sh ${DRONE_COMMIT_SHA}
volumes:
- name: dockersock
path: /var/run
when:
branch:
- action
- name: "build tag"
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 ${DRONE_TAG}
- sh .drone/push.sh ${DRONE_TAG}
volumes:
- name: dockersock
path: /var/run
when:
event:
- tag
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 "clone": {
name: deploy "disable": true
},
depends_on: "image_pull_secrets": [
- build "dockerconfigjson"
],
platform: "kind": "pipeline",
os: linux "name": "registry",
arch: amd64 "services": [
{
steps: "image": "docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f",
- name: scp "name": "docker",
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47 "privileged": true,
settings: "volumes": [
command_timeout: 2m {
source: "name": "dockersock",
- . "path": "/var/run"
target: /stack/gitea },
{
- name: deploy commit "name": "ca",
when: "path": "/etc/docker/certs.d"
branch: },
- action {
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea "name": "daemonjson",
settings: "path": "/etc/docker/daemon.json"
envs: }
- drone_tag ]
- drone_commit }
- drone_commit_sha ],
- drone_build_number "steps": [
- drone_repo_name {
- drone_repo_namespace "commands": [
- scheme "set -e",
- domain "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",
- registry_domain "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"
- registry_port ],
- registry_password "environment": { },
- gitea_mailer_host "image": "docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f",
- gitea_mailer_from "name": "gitea/gitea:1.12.3-linux-amd64",
- gitea_mailer_user "volumes": [
- gitea_app_name {
- gitea_server_lfs_jwt_secret "name": "dockersock",
- gitea_security_secret_key "path": "/var/run"
- gitea_security_internal_token }
- gitea_oauth2_jwt_secret ]
- gitea_mailer_passwd }
- gitea_mailer_protocol ],
script: "trigger": {
- export GITEA_SERVER_LFS_JWT_SECRET=$${GITEA_SERVER_LFS_JWT_SECRET} "event": [
- export GITEA_SECURITY_SECRET_KEY=$${GITEA_SECURITY_SECRET_KEY} "promote"
- export GITEA_SECURITY_INTERNAL_TOKEN=$${GITEA_SECURITY_INTERNAL_TOKEN} ],
- export GITEA_OAUTH2_JWT_SECRET=$${GITEA_OAUTH2_JWT_SECRET} "target": [
- export GITEA_MAILER_PASSWD=$${GITEA_MAILER_PASSWD} "registry"
- export GITEA_MAILER_PROTOCOL=$${GITEA_MAILER_PROTOCOL} ]
- export GITEA_MAILER_HOST=$${GITEA_MAILER_HOST} },
- export GITEA_MAILER_FROM=$${GITEA_MAILER_FROM} "type": "docker",
- export GITEA_MAILER_USER=$${GITEA_MAILER_USER} "volumes": [
- export GITEA_APP_NAME=$${GITEA_APP_NAME} {
- export SCHEME=$${SCHEME} "name": "dockersock",
- export DOMAIN=$${DOMAIN} "temp": { }
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN} },
- export REGISTRY_PORT=$${REGISTRY_PORT} {
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD} "host": {
- set -e "path": "/etc/docker/certs.d"
- export NAME=gitea },
- export ROOT=stack "name": "ca"
- cd /stack/gitea },
- "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" {
- printenv "host": {
- sh .drone/pull.sh ${DRONE_COMMIT_SHA} "path": "/etc/docker/daemon.json"
- sh .drone/deploy.sh ${DRONE_COMMIT_SHA} },
environment: "name": "daemonjson"
GITEA_APP_NAME: }
from_secret: gitea-app-name ]
GITEA_MAILER_FROM: }
from_secret: gitea-mailer-from ---
GITEA_MAILER_HOST: {
from_secret: gitea-mailer-host "clone": {
GITEA_MAILER_PASSWD: "disable": true
from_secret: gitea-mailer-passwd },
GITEA_MAILER_PROTOCOL: "kind": "pipeline",
from_secret: gitea-mailer-protocol "name": "save",
GITEA_MAILER_USER: "steps": [
from_secret: gitea-mailer-user {
GITEA_OAUTH2_JWT_SECRET: "image": "appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea",
from_secret: gitea-oauth2-jwt-secret "name": "mkdir",
GITEA_SECURITY_INTERNAL_TOKEN: "settings": {
from_secret: gitea-security-internal-token "envs": [
GITEA_SECURITY_SECRET_KEY: "drone_tag",
from_secret: gitea-security-secret-key "drone_commit",
GITEA_SERVER_LFS_JWT_SECRET: "drone_build_number",
from_secret: gitea-server-lfs-jwt-secret "drone_repo_name",
- name: deploy tag "drone_repo_namespace"
when: ],
event: "script": [
- tag "mkdir -p /stack/.images/gitea/built",
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea "rm -f /stack/.images/gitea/*.*",
settings: "rm -f /stack/.images/gitea/built/*.*"
envs: ]
- drone_tag }
- drone_commit },
- drone_commit_sha {
- drone_build_number "image": "appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea",
- drone_repo_name "name": "gitea/gitea:1.12.3-linux-amd64",
- drone_repo_namespace "settings": {
- scheme "envs": [
- domain "drone_tag",
- registry_domain "drone_commit",
- registry_port "drone_build_number",
- registry_password "drone_repo_name",
- gitea_mailer_host "drone_repo_namespace",
- gitea_mailer_from "registry_domain",
- gitea_mailer_user "registry_port",
- gitea_app_name "registry_password",
- gitea_server_lfs_jwt_secret "destination_registry"
- gitea_security_secret_key ],
- gitea_security_internal_token "script": [
- gitea_oauth2_jwt_secret "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",
- gitea_mailer_passwd "docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea/gitea:1.12.3-linux-amd64",
- gitea_mailer_protocol "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",
script: "echo \"docker load < gitea_gitea:1.12.3-linux-amd64.tar\" >> /stack/.images/gitea/load.sh",
- export GITEA_SERVER_LFS_JWT_SECRET=$${GITEA_SERVER_LFS_JWT_SECRET} "echo \"docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea/gitea:1.12.3-linux-amd64 $${DESTINATION_REGISTRY}/stack/gitea/gitea/gitea:1.12.3-linux-amd64\" >> /stack/.images/gitea/load.sh"
- export GITEA_SECURITY_SECRET_KEY=$${GITEA_SECURITY_SECRET_KEY} ]
- export GITEA_SECURITY_INTERNAL_TOKEN=$${GITEA_SECURITY_INTERNAL_TOKEN} }
- export GITEA_OAUTH2_JWT_SECRET=$${GITEA_OAUTH2_JWT_SECRET} },
- export GITEA_MAILER_PASSWD=$${GITEA_MAILER_PASSWD} {
- export GITEA_MAILER_PROTOCOL=$${GITEA_MAILER_PROTOCOL} "image": "appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea",
- export GITEA_MAILER_HOST=$${GITEA_MAILER_HOST} "name": "gitea",
- export GITEA_MAILER_FROM=$${GITEA_MAILER_FROM} "settings": {
- export GITEA_MAILER_USER=$${GITEA_MAILER_USER} "envs": [
- export GITEA_APP_NAME=$${GITEA_APP_NAME} "drone_tag",
- export SCHEME=$${SCHEME} "drone_commit",
- export DOMAIN=$${DOMAIN} "drone_build_number",
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN} "drone_repo_name",
- export REGISTRY_PORT=$${REGISTRY_PORT} "drone_repo_namespace",
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD} "registry_domain",
- set -e "registry_port",
- export NAME=gitea "registry_password",
- export ROOT=stack "destination_registry"
- cd /stack/gitea ],
- "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" "script": [
- printenv "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 ${DRONE_TAG} "docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea",
- sh .drone/deploy.sh ${DRONE_TAG} "docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea -o /stack/.images/gitea/built/gitea.tar",
environment: "echo \"docker load gitea.tar\" >> /stack/.images/gitea/built/load.sh",
GITEA_APP_NAME: "echo \"docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea ${DESINATION_REGISTRY}/stack/gitea/gitea\" >> /stack/.images/gitea/built/load.sh"
from_secret: gitea-app-name ]
GITEA_MAILER_FROM: }
from_secret: gitea-mailer-from }
GITEA_MAILER_HOST: ],
from_secret: gitea-mailer-host "trigger": {
GITEA_MAILER_PASSWD: "event": [
from_secret: gitea-mailer-passwd "promote"
GITEA_MAILER_PROTOCOL: ],
from_secret: gitea-mailer-protocol "target": [
GITEA_MAILER_USER: "save"
from_secret: gitea-mailer-user ]
GITEA_OAUTH2_JWT_SECRET: },
from_secret: gitea-oauth2-jwt-secret "type": "docker"
GITEA_SECURITY_INTERNAL_TOKEN: }
from_secret: gitea-security-internal-token ---
GITEA_SECURITY_SECRET_KEY: {
from_secret: gitea-security-secret-key "clone": {
GITEA_SERVER_LFS_JWT_SECRET: "depth": 0,
from_secret: gitea-server-lfs-jwt-secret "disable": false
},
... "kind": "pipeline",
"name": "print",
"steps": [
{
"environment": {
"GITEA_APP_NAME": {
"from_secret": "gitea-app-name"
},
"GITEA_MAILER_FROM": {
"from_secret": "gitea-mailer-from"
},
"GITEA_MAILER_HOST": {
"from_secret": "gitea-mailer-host"
},
"GITEA_MAILER_PASSWD": {
"from_secret": "gitea-mailer-passwd"
},
"GITEA_MAILER_USER": {
"from_secret": "gitea-mailer-user"
},
"GITEA_OAUTH2_JWT_SECRET": {
"from_secret": "gitea-oauth2-jwt-secret"
},
"GITEA_SECURITY_INTERNAL_TOKEN": {
"from_secret": "gitea-security-internal-token"
},
"GITEA_SECURITY_SECRET_KEY": {
"from_secret": "gitea-security-secret-key"
},
"GITEA_SERVER_LFS_JWT_SECRET": {
"from_secret": "gitea-server-lfs-jwt-secret"
},
"MYSQL_ROOT_PASSWORD": {
"from_secret": "mysql-root-password"
}
},
"image": "appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea",
"name": "print env",
"settings": {
"envs": [
"drone_tag",
"drone_commit",
"drone_build_number",
"drone_repo_name",
"drone_repo_namespace",
"gitea_mailer_host",
"gitea_mailer_from",
"gitea_mailer_user",
"gitea_app_name",
"gitea_server_lfs_jwt_secret",
"gitea_security_secret_key",
"gitea_security_internal_token",
"gitea_oauth2_jwt_secret",
"gitea_mailer_passwd",
"mysql_root_password"
],
"script": [
"rm -f env-gitea",
"echo \"export GITEA_MAILER_HOST='$${GITEA_MAILER_HOST}'\" >> env-gitea # \"gitea-mailer-host\"",
"echo \"export GITEA_MAILER_FROM='$${GITEA_MAILER_FROM}'\" >> env-gitea # \"gitea-mailer-from\"",
"echo \"export GITEA_MAILER_USER='$${GITEA_MAILER_USER}'\" >> env-gitea # \"gitea-mailer-user\"",
"echo \"export GITEA_APP_NAME='$${GITEA_APP_NAME}'\" >> env-gitea # \"gitea-app-name\"",
"echo \"export GITEA_SERVER_LFS_JWT_SECRET='$${GITEA_SERVER_LFS_JWT_SECRET}'\" >> env-gitea # \"gitea-server-lfs-jwt-secret\"",
"echo \"export GITEA_SECURITY_SECRET_KEY='$${GITEA_SECURITY_SECRET_KEY}'\" >> env-gitea # \"gitea-security-secret-key\"",
"echo \"export GITEA_SECURITY_INTERNAL_TOKEN='$${GITEA_SECURITY_INTERNAL_TOKEN}'\" >> env-gitea # \"gitea-security-internal-token\"",
"echo \"export GITEA_OAUTH2_JWT_SECRET='$${GITEA_OAUTH2_JWT_SECRET}'\" >> env-gitea # \"gitea-oauth2-jwt-secret\"",
"echo \"export GITEA_MAILER_PASSWD='$${GITEA_MAILER_PASSWD}'\" >> env-gitea # \"gitea-mailer-passwd\"",
"echo \"export MYSQL_ROOT_PASSWORD='$${MYSQL_ROOT_PASSWORD}'\" >> env-gitea # \"mysql-root-password\""
]
}
}
],
"trigger": {
"event": [
"promote"
],
"target": [
"print"
]
},
"type": "docker"
}
---
{
"clone": {
"depth": 0,
"disable": false
},
"kind": "pipeline",
"name": "print-secrets",
"steps": [
{
"environment": {
"GITEA_APP_NAME": {
"from_secret": "gitea-app-name"
},
"GITEA_MAILER_FROM": {
"from_secret": "gitea-mailer-from"
},
"GITEA_MAILER_HOST": {
"from_secret": "gitea-mailer-host"
},
"GITEA_MAILER_PASSWD": {
"from_secret": "gitea-mailer-passwd"
},
"GITEA_MAILER_USER": {
"from_secret": "gitea-mailer-user"
},
"GITEA_OAUTH2_JWT_SECRET": {
"from_secret": "gitea-oauth2-jwt-secret"
},
"GITEA_SECURITY_INTERNAL_TOKEN": {
"from_secret": "gitea-security-internal-token"
},
"GITEA_SECURITY_SECRET_KEY": {
"from_secret": "gitea-security-secret-key"
},
"GITEA_SERVER_LFS_JWT_SECRET": {
"from_secret": "gitea-server-lfs-jwt-secret"
},
"MYSQL_ROOT_PASSWORD": {
"from_secret": "mysql-root-password"
}
},
"image": "appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea",
"name": "print secrets command",
"settings": {
"envs": [
"drone_tag",
"drone_commit",
"drone_build_number",
"drone_repo_name",
"drone_repo_namespace",
"gitea_mailer_host",
"gitea_mailer_from",
"gitea_mailer_user",
"gitea_app_name",
"gitea_server_lfs_jwt_secret",
"gitea_security_secret_key",
"gitea_security_internal_token",
"gitea_oauth2_jwt_secret",
"gitea_mailer_passwd",
"mysql_root_password"
],
"script": [
"rm -f env-gitea-secret",
"echo \"docker secret add --name=GITEA_MAILER_HOST --data='$${GITEA_MAILER_HOST}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"gitea-mailer-host\"",
"echo \"docker secret add --name=GITEA_MAILER_FROM --data='$${GITEA_MAILER_FROM}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"gitea-mailer-from\"",
"echo \"docker secret add --name=GITEA_MAILER_USER --data='$${GITEA_MAILER_USER}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"gitea-mailer-user\"",
"echo \"docker secret add --name=GITEA_APP_NAME --data='$${GITEA_APP_NAME}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"gitea-app-name\"",
"echo \"docker secret add --name=GITEA_SERVER_LFS_JWT_SECRET --data='$${GITEA_SERVER_LFS_JWT_SECRET}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"gitea-server-lfs-jwt-secret\"",
"echo \"docker secret add --name=GITEA_SECURITY_SECRET_KEY --data='$${GITEA_SECURITY_SECRET_KEY}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"gitea-security-secret-key\"",
"echo \"docker secret add --name=GITEA_SECURITY_INTERNAL_TOKEN --data='$${GITEA_SECURITY_INTERNAL_TOKEN}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"gitea-security-internal-token\"",
"echo \"docker secret add --name=GITEA_OAUTH2_JWT_SECRET --data='$${GITEA_OAUTH2_JWT_SECRET}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"gitea-oauth2-jwt-secret\"",
"echo \"docker secret add --name=GITEA_MAILER_PASSWD --data='$${GITEA_MAILER_PASSWD}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"gitea-mailer-passwd\"",
"echo \"docker secret add --name=MYSQL_ROOT_PASSWORD --data='$${MYSQL_ROOT_PASSWORD}' $${DRONE_REPO_NAMESPACE}/$${DRONE_REPO_NAME}\" >> env-gitea-secret # \"mysql-root-password\""
]
}
}
],
"trigger": {
"event": [
"promote"
],
"target": [
"print-secrets"
]
},
"type": "docker"
}
---
{
"clone": {
"depth": 0,
"disable": false
},
"kind": "pipeline",
"name": "build",
"services": [
{
"image": "docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f",
"name": "docker",
"privileged": true,
"volumes": [
{
"name": "dockersock",
"path": "/var/run"
},
{
"name": "ca",
"path": "/etc/docker/certs.d"
},
{
"name": "daemonjson",
"path": "/etc/docker/daemon.json"
}
]
}
],
"steps": [
{
"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"
],
"environment": { },
"image": "docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f",
"name": "dockerbuild:",
"volumes": [
{
"name": "dockersock",
"path": "/var/run"
}
]
}
],
"trigger": {
"event": [
"promote"
],
"target": [
"build"
]
},
"type": "docker",
"volumes": [
{
"name": "dockersock",
"temp": { }
},
{
"host": {
"path": "/etc/docker/certs.d"
},
"name": "ca"
},
{
"host": {
"path": "/etc/docker/daemon.json"
},
"name": "daemonjson"
}
]
}
---
{
"clone": {
"depth": 0,
"disable": false
},
"kind": "pipeline",
"name": "deploy",
"steps": [
{
"image": "appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47",
"name": "scp",
"settings": {
"command_timeout": "2m",
"source": [
"."
],
"target": "/stack/gitea"
}
},
{
"environment": {
"GITEA_APP_NAME": {
"from_secret": "gitea-app-name"
},
"GITEA_MAILER_FROM": {
"from_secret": "gitea-mailer-from"
},
"GITEA_MAILER_HOST": {
"from_secret": "gitea-mailer-host"
},
"GITEA_MAILER_PASSWD": {
"from_secret": "gitea-mailer-passwd"
},
"GITEA_MAILER_USER": {
"from_secret": "gitea-mailer-user"
},
"GITEA_OAUTH2_JWT_SECRET": {
"from_secret": "gitea-oauth2-jwt-secret"
},
"GITEA_SECURITY_INTERNAL_TOKEN": {
"from_secret": "gitea-security-internal-token"
},
"GITEA_SECURITY_SECRET_KEY": {
"from_secret": "gitea-security-secret-key"
},
"GITEA_SERVER_LFS_JWT_SECRET": {
"from_secret": "gitea-server-lfs-jwt-secret"
},
"MYSQL_ROOT_PASSWORD": {
"from_secret": "mysql-root-password"
}
},
"image": "appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea",
"name": "deploy",
"settings": {
"envs": [
"drone_tag",
"drone_commit",
"drone_build_number",
"drone_repo_name",
"drone_repo_namespace",
"scheme",
"domain",
"registry_domain",
"registry_port",
"registry_password",
"gitea_mailer_host",
"gitea_mailer_from",
"gitea_mailer_user",
"gitea_app_name",
"gitea_server_lfs_jwt_secret",
"gitea_security_secret_key",
"gitea_security_internal_token",
"gitea_oauth2_jwt_secret",
"gitea_mailer_passwd",
"mysql_root_password"
],
"script": [
"export GITEA_SERVER_LFS_JWT_SECRET=$${GITEA_SERVER_LFS_JWT_SECRET}",
"export GITEA_SECURITY_SECRET_KEY=$${GITEA_SECURITY_SECRET_KEY}",
"export GITEA_SECURITY_INTERNAL_TOKEN=$${GITEA_SECURITY_INTERNAL_TOKEN}",
"export GITEA_OAUTH2_JWT_SECRET=$${GITEA_OAUTH2_JWT_SECRET}",
"export GITEA_MAILER_PASSWD=$${GITEA_MAILER_PASSWD}",
"export MYSQL_ROOT_PASSWORD=$${MYSQL_ROOT_PASSWORD}",
"export GITEA_MAILER_HOST=$${GITEA_MAILER_HOST}",
"export GITEA_MAILER_FROM=$${GITEA_MAILER_FROM}",
"export GITEA_MAILER_USER=$${GITEA_MAILER_USER}",
"export GITEA_APP_NAME=$${GITEA_APP_NAME}",
"export SCHEME=$${SCHEME}",
"export DOMAIN=$${DOMAIN}",
"export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}",
"export REGISTRY_PORT=$${REGISTRY_PORT}",
"export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}",
"set -e",
"export NAME=gitea",
"export ROOT=stack",
"cd /stack/gitea",
"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"
]
}
}
],
"trigger": {
"event": [
"promote"
],
"target": [
"deploy"
]
},
"type": "docker"
}

View File

@ -4,4 +4,5 @@
'gitea-security-internal-token', 'gitea-security-internal-token',
'gitea-oauth2-jwt-secret', 'gitea-oauth2-jwt-secret',
'gitea-mailer-passwd', 'gitea-mailer-passwd',
'mysql-root-password'
] ]

View File

@ -1 +1 @@
docker pull ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea:$1 docker pull ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea

View File

@ -1 +1 @@
docker push ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea:$1 docker push ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea

View File

@ -1,7 +1,7 @@
# gitea # gitea
## secrets ## secrets
* git-domain * domain
* gitea-app-name * gitea-app-name
* gitea-mailer-from * gitea-mailer-from
* gitea-mailer-host * gitea-mailer-host
@ -13,3 +13,7 @@
* gitea-server-lfs-jwt-secret * gitea-server-lfs-jwt-secret
* local-docker-registry * local-docker-registry
* registry-password * registry-password
## mysql
set up https://docs.gitea.io/en-us/database-prep/

View File

@ -3,11 +3,11 @@ services:
gitea: gitea:
deploy: deploy:
placement: placement:
constraints: [node.labels.com.sigyl.git-stack == yes] constraints: [node.labels.com.sigyl.gitea == yes]
replicas: 1 replicas: 1
restart_policy: restart_policy:
condition: any condition: any
image: ${LOCAL_DOCKER_REGISTRY}gitea:${TAG} image: ${LOCAL_DOCKER_REGISTRY}gitea
environment: environment:
- USER_UID=1000 - USER_UID=1000
- USER_GID=1000 - USER_GID=1000
@ -23,18 +23,41 @@ services:
- GITEA_MAILER_USER=$GITEA_MAILER_USER - GITEA_MAILER_USER=$GITEA_MAILER_USER
- GITEA_MAILER_FROM=$GITEA_MAILER_FROM - GITEA_MAILER_FROM=$GITEA_MAILER_FROM
- GITEA_MAILER_PASSWD=$GITEA_MAILER_PASSWD - GITEA_MAILER_PASSWD=$GITEA_MAILER_PASSWD
- GITEA_MAILER_PROTOCOL=$GITEA_MAILER_PROTOCOL - GITEA__database__DB_TYPE=mysql
- GITEA__database__HOST=mysql:3306
- GITEA__database__NAME=gitead
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=gitea
volumes: volumes:
- gitea-app:/data - gitea-app-4:/data
ports: ports:
- 3000:3000 - 3000:3000
- 22:22 - 22:22
networks: networks:
- appnet - appnet
- externalnet - externalnet
mysql:
image: ${DOCKER_REGISTRY}mysql:8
deploy:
placement:
constraints: [node.labels.com.sigyl.git-stack-data == yes]
replicas: 1
restart_policy:
condition: any
volumes:
- gitea-data-5:/var/lib/mysql
environment:
#- MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
- MYSQL_ROOT_PASSWORD=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
- MYSQL_DATABASE=gitea
networks:
- appnet
volumes: volumes:
gitea-app: gitea-app-4:
gitea-data-5:
networks: networks:
appnet: appnet:

View File

@ -1,6 +1,6 @@
ARG REGISTRY ARG REGISTRY
FROM gitea/gitea:1.20.5-linux-amd64 FROM ${REGISTRY}gitea/gitea:1.16.7-linux-amd64
COPY app.ini /init/ COPY app.ini /init/
COPY ./templates /init/templates/ #COPY ./templates /init/templates/
COPY run.sh / COPY run.sh /
CMD ["sh", "/run.sh"] CMD ["sh", "/run.sh"]

View File

@ -56,8 +56,8 @@ PATH = /data/gitea/attachments
[log] [log]
ROOT_PATH = /data/gitea/log ROOT_PATH = /data/gitea/log
MODE = file MODE = console
LEVEL = info LEVEL = debug
[security] [security]
INSTALL_LOCK = true INSTALL_LOCK = true
@ -65,7 +65,8 @@ SECRET_KEY = ${GITEA_SECURITY_SECRET_KEY}
INTERNAL_TOKEN = ${GITEA_SECURITY_INTERNAL_TOKEN} INTERNAL_TOKEN = ${GITEA_SECURITY_INTERNAL_TOKEN}
PASSWORD_COMPLEXITY = off PASSWORD_COMPLEXITY = off
[service] [service]
DISABLE_REGISTRATION = true DISABLE_REGISTRATION = false
SHOW_REGISTRATION_BUTTON = true
REQUIRE_SIGNIN_VIEW = false REQUIRE_SIGNIN_VIEW = false
REGISTER_EMAIL_CONFIRM = true REGISTER_EMAIL_CONFIRM = true
ENABLE_NOTIFY_MAIL = true ENABLE_NOTIFY_MAIL = true
@ -89,3 +90,6 @@ PASSWD = ${GITEA_MAILER_PASSWD}
[openid] [openid]
ENABLE_OPENID_SIGNIN = true ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true ENABLE_OPENID_SIGNUP = true
[webhook]
ALLOWED_HOST_LIST=*

0
gitea/new-app.ini Normal file
View File

View File

@ -1,4 +1,5 @@
envsubst < /init/app.ini > /data/gitea/conf/app.ini envsubst < /init/app.ini > /data/gitea/conf/app.ini
cat /data/gitea/conf/app.ini
mkdir -p /data/gitea/templates mkdir -p /data/gitea/templates
for file in /init/templates/* for file in /init/templates/*
do do

View File

@ -3,7 +3,7 @@
<div class="ui stackable middle very relaxed page grid"> <div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide center aligned centered column"> <div class="sixteen wide center aligned centered column">
<div> <div>
<img class="logo" src="{{AssetUrlPrefix}}/img/gitea-lg.png" /> <img class="logo" src="{{StaticUrlPrefix}}/img/gitea-lg.png" />
</div> </div>
<div class="hero"> <div class="hero">
<h1 class="ui icon header title"> <h1 class="ui icon header title">

2
node_modules/.yarn-integrity generated vendored
View File

@ -1,5 +1,5 @@
{ {
"systemParams": "darwin-x64-72", "systemParams": "linux-x64-108",
"modulesFolders": [ "modulesFolders": [
"node_modules" "node_modules"
], ],