298 lines
9.9 KiB
YAML
298 lines
9.9 KiB
YAML
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
|
|
name: build
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
steps:
|
|
- name: "build commit ${DRONE_COMMIT_SHA}"
|
|
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_COMMIT_SHA}
|
|
- sh .drone/push.sh ${DRONE_COMMIT_SHA}
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
when:
|
|
branch:
|
|
- actions
|
|
- name: "build tag ${DRONE_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
|
|
name: deploy
|
|
|
|
depends_on:
|
|
- build
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
steps:
|
|
- name: scp
|
|
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
|
settings:
|
|
command_timeout: 2m
|
|
source:
|
|
- .
|
|
target: /stack/gitea
|
|
|
|
- name: deploy commit ${DRONE_COMMIT_SHA}
|
|
when:
|
|
branch:
|
|
- actions
|
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
|
settings:
|
|
envs:
|
|
- drone_tag
|
|
- drone_commit
|
|
- drone_commit_sha
|
|
- 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
|
|
- gitea_mailer_protocol
|
|
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 GITEA_MAILER_PROTOCOL=$${GITEA_MAILER_PROTOCOL}
|
|
- 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/deploy.sh ${DRONE_COMMIT_SHA}
|
|
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
|
|
- name: deploy tag ${DRONE_TAG}
|
|
when:
|
|
event:
|
|
- tag
|
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
|
settings:
|
|
envs:
|
|
- drone_tag
|
|
- drone_commit
|
|
- drone_commit_sha
|
|
- 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
|
|
- gitea_mailer_protocol
|
|
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 GITEA_MAILER_PROTOCOL=$${GITEA_MAILER_PROTOCOL}
|
|
- 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/deploy.sh ${DRONE_TAG}
|
|
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
|
|
|
|
...
|