--- { "clone": { "disable": true }, "kind": "pipeline", "name": "register", "trigger": { "event": { "exclude": [ "promote" ] } }, "type": "docker" } --- { "clone": { "disable": true }, "image_pull_secrets": [ "dockerconfigjson" ], "kind": "pipeline", "name": "registry", "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", "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", "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" ], "environment": { }, "image": "docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f", "name": "gitea/gitea:1.12.3-linux-amd64", "volumes": [ { "name": "dockersock", "path": "/var/run" } ] } ], "trigger": { "event": [ "promote" ], "target": [ "registry" ] }, "type": "docker", "volumes": [ { "name": "dockersock", "temp": { } }, { "host": { "path": "/etc/docker/certs.d" }, "name": "ca" }, { "host": { "path": "/etc/docker/daemon.json" }, "name": "daemonjson" } ] } --- { "clone": { "disable": true }, "kind": "pipeline", "name": "save", "steps": [ { "image": "appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea", "name": "mkdir", "settings": { "envs": [ "drone_tag", "drone_commit", "drone_build_number", "drone_repo_name", "drone_repo_namespace" ], "script": [ "mkdir -p /stack/.images/gitea/built", "rm -f /stack/.images/gitea/*.*", "rm -f /stack/.images/gitea/built/*.*" ] } }, { "image": "appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea", "name": "gitea/gitea:1.12.3-linux-amd64", "settings": { "envs": [ "drone_tag", "drone_commit", "drone_build_number", "drone_repo_name", "drone_repo_namespace", "registry_domain", "registry_port", "registry_password", "destination_registry" ], "script": [ "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", "docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea/gitea:1.12.3-linux-amd64", "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", "echo \"docker load < gitea_gitea:1.12.3-linux-amd64.tar\" >> /stack/.images/gitea/load.sh", "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" ] } }, { "image": "appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea", "name": "gitea", "settings": { "envs": [ "drone_tag", "drone_commit", "drone_build_number", "drone_repo_name", "drone_repo_namespace", "registry_domain", "registry_port", "registry_password", "destination_registry" ], "script": [ "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", "docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea", "docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea -o /stack/.images/gitea/built/gitea.tar", "echo \"docker load gitea.tar\" >> /stack/.images/gitea/built/load.sh", "echo \"docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/gitea/gitea ${DESINATION_REGISTRY}/stack/gitea/gitea\" >> /stack/.images/gitea/built/load.sh" ] } } ], "trigger": { "event": [ "promote" ], "target": [ "save" ] }, "type": "docker" } --- { "clone": { "depth": 0, "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" }