Compare commits

...

30 Commits

Author SHA1 Message Date
Giles Bradshaw 706d4e3e2b feat: registry promotion
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2020-09-24 16:49:52 +01:00
Giles Bradshaw 197f218e41 . 2020-09-22 16:12:52 +01:00
Giles Bradshaw 31ab8dc79c . 2020-09-22 16:11:11 +01:00
Giles Bradshaw 75600868c4 .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2020-09-22 16:06:34 +01:00
Giles Bradshaw fd6a8ece67 . 2020-09-22 15:52:34 +01:00
Giles Bradshaw 4d518afe84 .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2020-09-22 14:52:57 +01:00
Giles Bradshaw b96901fce8 .
continuous-integration/drone/push Build is passing Details
2020-09-22 14:48:35 +01:00
Giles Bradshaw 171f180b2c .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details
2020-09-22 14:47:23 +01:00
Giles Bradshaw d4bf6da6ba .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details
2020-09-22 14:45:38 +01:00
Giles Bradshaw 09f09171fd .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details
2020-09-22 14:44:39 +01:00
Giles Bradshaw dae297227e .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details
2020-09-22 14:43:14 +01:00
Giles Bradshaw 8a845975f0 .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details
2020-09-22 14:41:46 +01:00
Giles Bradshaw 7e17a997e7 .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details
2020-09-22 14:39:45 +01:00
Giles Bradshaw 891e5055c2 .
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details
2020-09-22 14:21:12 +01:00
Giles Bradshaw c7f9614125 . 2020-09-22 14:13:15 +01:00
Giles Bradshaw 874531b821 . 2020-09-22 14:11:05 +01:00
Giles Bradshaw b1c789e20c Merge branch 'master' into develop 2020-09-22 13:52:21 +01:00
Giles Bradshaw 18d64e025c . 2020-09-22 13:41:27 +01:00
Giles Bradshaw 5bd0f6bdd2 ci:
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2020-08-28 17:48:20 +01:00
Giles Bradshaw 77ec8bd0f0 ci: fix port
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2020-08-28 17:41:04 +01:00
Giles Bradshaw 15c2b64411 ci: jsonnet deon 0.1.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details
2020-08-28 16:23:47 +01:00
Giles b66864b03e empty 2020-08-21 08:15:44 +01:00
Giles 964f471696 empty 2020-08-21 08:14:41 +01:00
Giles a96049032c fix: jsonnet drone 0.0.7
continuous-integration/drone/push Build is passing Details
2020-08-21 08:11:30 +01:00
Giles 46801da4c5 empty
continuous-integration/drone/push Build is passing Details
2020-08-20 08:22:30 +01:00
Giles 7544ddbc07 empty 2020-08-20 08:21:33 +01:00
Giles f4e8757ac1 chore(release): 0.0.4 2020-08-20 00:08:51 +01:00
Giles d040595fe7 ci: moved scripts 2020-08-20 00:08:33 +01:00
Giles 60294d7ef6 ci: built with jsonnet library 2020-08-19 22:00:32 +01:00
Giles c72e205ae6 ci: jsonnet 2020-08-13 19:36:40 +01:00
13 changed files with 118 additions and 47 deletions

View File

@ -1,14 +0,0 @@
load("@this//gitea:drone.star", "drone")
load("@this//gitea:stack-name.star", "stackName")
load("@this//gitea:stack-root.star", "stackRoot")
def main(ctx):
return drone(
ctx,
"home-deploy",
stackRoot,
stackName,
[]
)

View File

@ -1 +1,3 @@
docker build gitea -t ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/gitea
docker build gitea \
--build-arg REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/ \
-t ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/gitea

View File

@ -1,4 +1,5 @@
docker stack rm gitea
echo 'sleeping...zzz'
sleep 60
docker stack deploy -c docker-compose.yml gitea
export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/ \
&& docker stack rm gitea \
&& echo 'sleeping...zzz' \
&& sleep 60 \
&& docker stack deploy -c docker-compose.yml gitea

View File

@ -4,9 +4,30 @@ 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 config = {
registry: '',
};
[
register,
deploy(
registry(
config {
script: 'sh .drone/scripts/initialise-images.sh',
secrets: [],
},
) {
trigger +: {
event +: [
'promote',
],
target +: [
'registry',
],
},
},
deploy(config)(
'gitea',
'/stack/',
[],

View File

@ -15,6 +15,52 @@ trigger:
exclude:
- promote
---
kind: pipeline
type: docker
name: registry
platform:
os: linux
arch: amd64
steps:
- name: "dockerpull and save docker images:"
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}
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
volumes:
- name: dockersock
temp: {}
- name: ca
host:
path: /etc/docker/certs.d
image_pull_secrets:
- dockerconfigjson
trigger:
event:
- promote
target:
- registry
---
kind: pipeline
type: docker
@ -43,10 +89,6 @@ steps:
- gitea_security_internal_token
- gitea_oauth2_jwt_secret
- gitea_mailer_passwd
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script:
- rm -f env-gitea
- "echo \"export GITEA_MAILER_HOST='$${GITEA_MAILER_HOST}'\" >> env-gitea # \"gitea-mailer-host\""
@ -58,7 +100,6 @@ steps:
- "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\""
username: ${SSH_USER}
environment:
GITEA_APP_NAME:
from_secret: gitea-app-name
@ -83,14 +124,9 @@ steps:
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/gitea
username: ${SSH_USER}
- name: wait
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
@ -131,10 +167,6 @@ steps:
- gitea_security_internal_token
- gitea_oauth2_jwt_secret
- gitea_mailer_passwd
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script:
- export GITEA_SERVER_LFS_JWT_SECRET=$${GITEA_SERVER_LFS_JWT_SECRET}
- export GITEA_SECURITY_SECRET_KEY=$${GITEA_SECURITY_SECRET_KEY}
@ -154,7 +186,6 @@ steps:
- sh .drone/login.sh
- sh .drone/pull.sh
- sh .drone/deploy.sh
username: ${SSH_USER}
environment:
GITEA_APP_NAME:
from_secret: gitea-app-name

View File

@ -4,6 +4,6 @@
"build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream"
},
"dependencies": {
"@sigyl/jsonnet-drone": "^0.1.0"
"@sigyl/jsonnet-drone": "^0.3.1"
}
}

View File

@ -0,0 +1,15 @@
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

View File

@ -0,0 +1,2 @@
sh $(dirname $0)/login.sh $1 "$2" \
&& sh $(dirname $0)/initialise-image.sh $1 gitea/gitea:1.12.3-linux-amd64

13
.drone/scripts/login.sh Normal file
View File

@ -0,0 +1,13 @@
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

View File

@ -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.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.0.tgz#feda1797e8e9ef799cad72e65f7163ca26a9e3a5"
integrity sha512-QY/ngucxFOtLfL8Mt0f2bxN4fQDUOGOFtaRpSH2cNyg84xADkzehT0ORZtbLitr+AwhyF5KN/zAGvzkyNAoqPw==
"@sigyl/jsonnet-drone@^0.3.1":
version "0.3.1"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.3.1.tgz#790a83f45556cc613f07fbc98ca760027fa936e7"
integrity sha512-FiSyunjR0Udc20I2gA6gkzX3sCB2dPq/ZODrXcm7ROQFKF2Wr4b+xhpovjEdnjKGy8G4d+rRcdN+Jyhp7WQLEg==
dependencies:
"@sigyl/jsonnet-compose" "^0.0.2"
"@sigyl/jsonnet-drone-environment" "0.0.5"

View File

@ -7,14 +7,13 @@ services:
replicas: 1
restart_policy:
condition: any
image: ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/gitea
image: ${LOCAL_DOCKER_REGISTRY}gitea
environment:
- USER_UID=1000
- USER_GID=1000
- ROOT_URL=https://${DOMAIN}/git
- SSH_DOMAIN=${DOMAIN}
- GITEA_APP_NAME=${GITEA_APP_NAME}
- GIT_DOMAIN=${DOMAIN}
- GITEA_DOMAIN=${DOMAIN}
- GITEA_SERVER_LFS_JWT_SECRET=$GITEA_SERVER_LFS_JWT_SECRET
- GITEA_SECURITY_SECRET_KEY=$GITEA_SECURITY_SECRET_KEY
- GITEA_SECURITY_INTERNAL_TOKEN=$GITEA_SECURITY_INTERNAL_TOKEN

View File

@ -1,4 +1,5 @@
FROM gitea/gitea:1.12.3-linux-amd64
ARG REGISTRY
FROM ${REGISTRY}gitea/gitea:1.12.3-linux-amd64
COPY app.ini /init/
COPY ./templates /init/templates/
COPY run.sh /

View File

@ -17,13 +17,13 @@ TEMP_PATH = /data/gitea/uploads
APP_DATA_PATH = /data/gitea
SSH_DOMAIN = ${DOMAIN}
HTTP_PORT = 3000
ROOT_URL = https://${DOMAIN}/git/
ROOT_URL = https://${GITEA_DOMAIN}/git/
DISABLE_SSH = false
SSH_PORT = 22
SSH_LISTEN_PORT = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /data/git/lfs
DOMAIN = ${DOMAIN}
DOMAIN = ${GITEA_DOMAIN}
LFS_JWT_SECRET = ${GITEA_SERVER_LFS_JWT_SECRET}
OFFLINE_MODE = false
@ -74,7 +74,7 @@ ENABLE_CAPTCHA = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.${DOMAIN}
NO_REPLY_ADDRESS = noreply.${GITEA_DOMAIN}
[oauth2]
JWT_SECRET = ${GITEA_OAUTH2_JWT_SECRET}