168 lines
4.4 KiB
YAML
168 lines
4.4 KiB
YAML
|
---
|
||
|
kind: pipeline
|
||
|
type: docker
|
||
|
name: build
|
||
|
|
||
|
platform:
|
||
|
os: linux
|
||
|
arch: amd64
|
||
|
|
||
|
steps:
|
||
|
- name: print env
|
||
|
image: appleboy/drone-ssh:1.6.2
|
||
|
settings:
|
||
|
envs:
|
||
|
- drone_tag
|
||
|
- drone_commit
|
||
|
- drone_build_number
|
||
|
- drone_repo_name
|
||
|
- drone_repo_namespace
|
||
|
- git_domain
|
||
|
- local_docker_registry
|
||
|
- gitea_mailer_host
|
||
|
- gitea_mailer_from
|
||
|
- gitea_mailer_user
|
||
|
- gitea_app_name
|
||
|
host:
|
||
|
from_secret: ssh-host
|
||
|
password:
|
||
|
from_secret: ssh-password
|
||
|
port:
|
||
|
from_secret: ssh-port
|
||
|
script:
|
||
|
- rm -f env-gitea
|
||
|
- "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_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\""
|
||
|
username:
|
||
|
from_secret: ssh-user
|
||
|
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_USER:
|
||
|
from_secret: gitea-mailer-user
|
||
|
GIT_DOMAIN:
|
||
|
from_secret: git-domain
|
||
|
LOCAL_DOCKER_REGISTRY:
|
||
|
from_secret: local-docker-registry
|
||
|
|
||
|
- name: scp
|
||
|
image: appleboy/drone-scp:1.6.2
|
||
|
settings:
|
||
|
command_timeout: 2m
|
||
|
host:
|
||
|
from_secret: ssh-host
|
||
|
password:
|
||
|
from_secret: ssh-password
|
||
|
port:
|
||
|
from_secret: ssh-port
|
||
|
source:
|
||
|
- .
|
||
|
target: /stack/gitea
|
||
|
username:
|
||
|
from_secret: ssh-user
|
||
|
|
||
|
- name: wait
|
||
|
image: alpine
|
||
|
commands:
|
||
|
- sleep 15
|
||
|
|
||
|
- name: deploy stack
|
||
|
image: appleboy/drone-ssh:1.6.2
|
||
|
settings:
|
||
|
envs:
|
||
|
- drone_tag
|
||
|
- drone_commit
|
||
|
- drone_build_number
|
||
|
- drone_repo_name
|
||
|
- drone_repo_namespace
|
||
|
- git_domain
|
||
|
- local_docker_registry
|
||
|
- 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
|
||
|
- registry_password
|
||
|
host:
|
||
|
from_secret: ssh-host
|
||
|
password:
|
||
|
from_secret: ssh-password
|
||
|
port:
|
||
|
from_secret: ssh-port
|
||
|
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 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_FROM=$${GITEA_MAILER_FROM}
|
||
|
- export GITEA_MAILER_USER=$${GITEA_MAILER_USER}
|
||
|
- export GITEA_APP_NAME=$${GITEA_APP_NAME}
|
||
|
- set -e
|
||
|
- cd /stack/gitea
|
||
|
- docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${REGISTRY_PASSWORD}"
|
||
|
- sh pull.sh
|
||
|
- sh deploy.sh
|
||
|
username:
|
||
|
from_secret: ssh-user
|
||
|
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
|
||
|
GIT_DOMAIN:
|
||
|
from_secret: git-domain
|
||
|
LOCAL_DOCKER_REGISTRY:
|
||
|
from_secret: local-docker-registry
|
||
|
REGISTRY_PASSWORD:
|
||
|
from_secret: registry-password
|
||
|
|
||
|
services:
|
||
|
- name: docker
|
||
|
image: docker:dind
|
||
|
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
|
||
|
|
||
|
...
|