ci: jsonnet deon 0.1.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details

This commit is contained in:
Giles Bradshaw 2020-08-28 16:23:47 +01:00
parent b66864b03e
commit 15c2b64411
13 changed files with 86 additions and 90 deletions

View File

@ -1 +1 @@
docker build gitea -t ${LOCAL_DOCKER_REGISTRY}gitea docker build gitea -t ${REGISTRY_DOMAIN}:${REGISTRY_PASSWORD}/gitea

View File

@ -3,15 +3,29 @@ local secretSecrets = import 'lib/secret-secrets.libsonnet';
local publicSecrets = import 'lib/public-secrets.libsonnet'; 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 registry = import 'node_modules/@sigyl/jsonnet-drone/registry.libsonnet';
[ [
registry,
deploy( deploy(
'gitea', 'gitea',
'/stack/', '/stack/',
[],
publicSecrets,
secretSecrets,
[ [
'LOCAL_DOCKER_REGISTRY', 'DOMAIN',
'REGISTRY_DOMAIN',
'REGISTRY_PORT',
'REGISTRY_PASSWORD', 'REGISTRY_PASSWORD',
], ],
publicSecrets, ) {
secretSecrets trigger +: {
), event +: [
'promote',
],
target +: [
'production',
],
},
},
] ]

View File

@ -1,3 +1,20 @@
---
kind: pipeline
type: docker
name: register
platform:
os: linux
arch: amd64
clone:
disable: true
trigger:
event:
exclude:
- promote
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
@ -9,7 +26,7 @@ platform:
steps: steps:
- name: print env - name: print env
image: appleboy/drone-ssh:1.6.2 image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
settings: settings:
envs: envs:
- drone_tag - drone_tag
@ -17,10 +34,6 @@ steps:
- drone_build_number - drone_build_number
- drone_repo_name - drone_repo_name
- drone_repo_namespace - drone_repo_namespace
- local_docker_registry
- registry_password
- git_domain
- local_docker_registry
- gitea_mailer_host - gitea_mailer_host
- gitea_mailer_from - gitea_mailer_from
- gitea_mailer_user - gitea_mailer_user
@ -30,19 +43,12 @@ steps:
- gitea_security_internal_token - gitea_security_internal_token
- gitea_oauth2_jwt_secret - gitea_oauth2_jwt_secret
- gitea_mailer_passwd - gitea_mailer_passwd
- registry_password host: ${SSH_HOST}
host: key: ${SSH_KEY}
from_secret: ssh-host passphrase: ${SSH_PASSPHRASE}
key: port: ${SSH_PORT}
from_secret: ssh-key
port:
from_secret: ssh-port
script: script:
- rm -f env-gitea - rm -f env-gitea
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-gitea # \"local-docker-registry\""
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-gitea # \"registry-password\""
- "echo \"export GIT_DOMAIN='$${GIT_DOMAIN}'\" >> env-gitea # \"git-domain\""
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-gitea # \"local-docker-registry\""
- "echo \"export GITEA_MAILER_HOST='$${GITEA_MAILER_HOST}'\" >> env-gitea # \"gitea-mailer-host\"" - "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_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_MAILER_USER='$${GITEA_MAILER_USER}'\" >> env-gitea # \"gitea-mailer-user\""
@ -52,9 +58,7 @@ steps:
- "echo \"export GITEA_SECURITY_INTERNAL_TOKEN='$${GITEA_SECURITY_INTERNAL_TOKEN}'\" >> env-gitea # \"gitea-security-internal-token\"" - "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_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_PASSWD='$${GITEA_MAILER_PASSWD}'\" >> env-gitea # \"gitea-mailer-passwd\""
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-gitea # \"registry-password\"" username: ${SSH_USER}
username:
from_secret: ssh-user
environment: environment:
GITEA_APP_NAME: GITEA_APP_NAME:
from_secret: gitea-app-name from_secret: gitea-app-name
@ -74,53 +78,39 @@ steps:
from_secret: gitea-security-secret-key from_secret: gitea-security-secret-key
GITEA_SERVER_LFS_JWT_SECRET: GITEA_SERVER_LFS_JWT_SECRET:
from_secret: gitea-server-lfs-jwt-secret from_secret: gitea-server-lfs-jwt-secret
GIT_DOMAIN:
from_secret: git-domain
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
- name: scp - name: scp
image: appleboy/drone-scp:1.6.2 image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
settings: settings:
command_timeout: 2m command_timeout: 2m
host: host: ${SSH_HOST}
from_secret: ssh-host key: ${SSH_KEY}
key: passphrase: ${SSH_PASSPHRASE}
from_secret: ssh-key port: ${SSH_PORT}
port:
from_secret: ssh-port
source: source:
- . - .
target: /stack/gitea target: /stack/gitea
username: username: ${SSH_USER}
from_secret: ssh-user
- name: wait - name: wait
image: alpine image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
commands: commands:
- sleep 15 - sleep 15
- name: "dockerbuild:" - name: "dockerbuild:"
image: docker:dind image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
commands: commands:
- set -e - set -e
- sh .drone/login.sh - sh .drone/login.sh
- sh .drone/build.sh - sh .drone/build.sh
- sh .drone/push.sh - sh .drone/push.sh
- sh .drone/logout.sh - sh .drone/logout.sh
environment:
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
volumes: volumes:
- name: dockersock - name: dockersock
path: /var/run path: /var/run
- name: deploy - name: deploy
image: appleboy/drone-ssh:1.6.2 image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
settings: settings:
envs: envs:
- drone_tag - drone_tag
@ -128,8 +118,10 @@ steps:
- drone_build_number - drone_build_number
- drone_repo_name - drone_repo_name
- drone_repo_namespace - drone_repo_namespace
- git_domain - domain
- local_docker_registry - registry_domain
- registry_port
- registry_password
- gitea_mailer_host - gitea_mailer_host
- gitea_mailer_from - gitea_mailer_from
- gitea_mailer_user - gitea_mailer_user
@ -139,37 +131,30 @@ steps:
- gitea_security_internal_token - gitea_security_internal_token
- gitea_oauth2_jwt_secret - gitea_oauth2_jwt_secret
- gitea_mailer_passwd - gitea_mailer_passwd
- registry_password host: ${SSH_HOST}
- local_docker_registry key: ${SSH_KEY}
- registry_password passphrase: ${SSH_PASSPHRASE}
host: port: ${SSH_PORT}
from_secret: ssh-host
key:
from_secret: ssh-key
port:
from_secret: ssh-port
script: script:
- export GITEA_SERVER_LFS_JWT_SECRET=$${GITEA_SERVER_LFS_JWT_SECRET} - export GITEA_SERVER_LFS_JWT_SECRET=$${GITEA_SERVER_LFS_JWT_SECRET}
- export GITEA_SECURITY_SECRET_KEY=$${GITEA_SECURITY_SECRET_KEY} - export GITEA_SECURITY_SECRET_KEY=$${GITEA_SECURITY_SECRET_KEY}
- export GITEA_SECURITY_INTERNAL_TOKEN=$${GITEA_SECURITY_INTERNAL_TOKEN} - export GITEA_SECURITY_INTERNAL_TOKEN=$${GITEA_SECURITY_INTERNAL_TOKEN}
- export GITEA_OAUTH2_JWT_SECRET=$${GITEA_OAUTH2_JWT_SECRET} - export GITEA_OAUTH2_JWT_SECRET=$${GITEA_OAUTH2_JWT_SECRET}
- export GITEA_MAILER_PASSWD=$${GITEA_MAILER_PASSWD} - export GITEA_MAILER_PASSWD=$${GITEA_MAILER_PASSWD}
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
- export GIT_DOMAIN=$${GIT_DOMAIN}
- export LOCAL_DOCKER_REGISTRY=$${LOCAL_DOCKER_REGISTRY}
- export GITEA_MAILER_HOST=$${GITEA_MAILER_HOST} - export GITEA_MAILER_HOST=$${GITEA_MAILER_HOST}
- export GITEA_MAILER_FROM=$${GITEA_MAILER_FROM} - export GITEA_MAILER_FROM=$${GITEA_MAILER_FROM}
- export GITEA_MAILER_USER=$${GITEA_MAILER_USER} - export GITEA_MAILER_USER=$${GITEA_MAILER_USER}
- export GITEA_APP_NAME=$${GITEA_APP_NAME} - export GITEA_APP_NAME=$${GITEA_APP_NAME}
- export LOCAL_DOCKER_REGISTRY=$${LOCAL_DOCKER_REGISTRY} - export DOMAIN=$${DOMAIN}
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
- export REGISTRY_PORT=$${REGISTRY_PORT}
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD} - export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
- set -e - set -e
- cd /stack/gitea - cd /stack/gitea
- sh .drone/login.sh - sh .drone/login.sh
- sh .drone/pull.sh - sh .drone/pull.sh
- sh .drone/deploy.sh - sh .drone/deploy.sh
username: username: ${SSH_USER}
from_secret: ssh-user
environment: environment:
GITEA_APP_NAME: GITEA_APP_NAME:
from_secret: gitea-app-name from_secret: gitea-app-name
@ -189,16 +174,10 @@ steps:
from_secret: gitea-security-secret-key from_secret: gitea-security-secret-key
GITEA_SERVER_LFS_JWT_SECRET: GITEA_SERVER_LFS_JWT_SECRET:
from_secret: gitea-server-lfs-jwt-secret from_secret: gitea-server-lfs-jwt-secret
GIT_DOMAIN:
from_secret: git-domain
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
REGISTRY_PASSWORD:
from_secret: registry-password
services: services:
- name: docker - name: docker
image: docker:dind image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
privileged: true privileged: true
volumes: volumes:
- name: dockersock - name: dockersock
@ -213,4 +192,10 @@ volumes:
host: host:
path: /etc/docker/certs.d path: /etc/docker/certs.d
trigger:
event:
- promote
target:
- production
... ...

View File

@ -1,6 +1,4 @@
[ [
'git-domain',
'local-docker-registry',
'gitea-mailer-host', 'gitea-mailer-host',
'gitea-mailer-from', 'gitea-mailer-from',
'gitea-mailer-user', 'gitea-mailer-user',

View File

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

View File

@ -1 +1 @@
docker login ${LOCAL_DOCKER_REGISTRY} --username client --password "${REGISTRY_PASSWORD}" docker login ${REGISTRY_DOMAIN}:${REGISTRY_PASSWORD} --username client --password "${REGISTRY_PASSWORD}"

View File

@ -1 +1 @@
docker logout ${LOCAL_DOCKER_REGISTRY} docker logout ${REGISTRY_DOMAIN}:${REGISTRY_PASSWORD}

View File

@ -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.0.7" "@sigyl/jsonnet-drone": "^0.1.0"
} }
} }

View File

@ -1 +1 @@
docker pull ${LOCAL_DOCKER_REGISTRY}gitea docker pull ${REGISTRY_DOMAIN}:${REGISTRY_PASSWORD}/gitea

View File

@ -1 +1 @@
docker push ${LOCAL_DOCKER_REGISTRY}gitea docker push ${REGISTRY_DOMAIN}:${REGISTRY_PASSWORD}/gitea

View File

@ -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.0.7": "@sigyl/jsonnet-drone@^0.1.0":
version "0.0.7" version "0.1.0"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.0.7.tgz#0f92ef15096b0c5497741ff56bfbd249de9edd66" resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.0.tgz#feda1797e8e9ef799cad72e65f7163ca26a9e3a5"
integrity sha512-353n/zExNnKPPZ235eLX3/DFXJVNIX8fdAeG3RvY+55538eGzDIk0/3HJd8jXsD6y0zxm+LexW5HghvXBMBOEA== integrity sha512-QY/ngucxFOtLfL8Mt0f2bxN4fQDUOGOFtaRpSH2cNyg84xADkzehT0ORZtbLitr+AwhyF5KN/zAGvzkyNAoqPw==
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"

View File

@ -11,10 +11,10 @@ services:
environment: environment:
- USER_UID=1000 - USER_UID=1000
- USER_GID=1000 - USER_GID=1000
- ROOT_URL=https://${GIT_DOMAIN}/git - ROOT_URL=https://${DOMAIN}/git
- SSH_DOMAIN=${GIT_DOMAIN} - SSH_DOMAIN=${DOMAIN}
- GITEA_APP_NAME=${GITEA_APP_NAME} - GITEA_APP_NAME=${GITEA_APP_NAME}
- GIT_DOMAIN=${GIT_DOMAIN} - GIT_DOMAIN=${DOMAIN}
- GITEA_SERVER_LFS_JWT_SECRET=$GITEA_SERVER_LFS_JWT_SECRET - GITEA_SERVER_LFS_JWT_SECRET=$GITEA_SERVER_LFS_JWT_SECRET
- GITEA_SECURITY_SECRET_KEY=$GITEA_SECURITY_SECRET_KEY - GITEA_SECURITY_SECRET_KEY=$GITEA_SECURITY_SECRET_KEY
- GITEA_SECURITY_INTERNAL_TOKEN=$GITEA_SECURITY_INTERNAL_TOKEN - GITEA_SECURITY_INTERNAL_TOKEN=$GITEA_SECURITY_INTERNAL_TOKEN

View File

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