From b8480a52355fead7690a8e67a1496067a90975ce Mon Sep 17 00:00:00 2001 From: Giles Date: Wed, 19 Aug 2020 23:18:06 +0100 Subject: [PATCH] ci built with library --- .drone/drone-home.yml | 224 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 .drone/drone-home.yml diff --git a/.drone/drone-home.yml b/.drone/drone-home.yml new file mode 100644 index 0000000..103c93b --- /dev/null +++ b/.drone/drone-home.yml @@ -0,0 +1,224 @@ +--- +kind: pipeline +type: docker +name: deploy + +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 + - local_docker_registry + - registry_password + - commento_origin + - commento_smtp_host + - commento_smtp_port + - commento_smtp_username + - commento_smtp_from_address + - commento_forbid_new_owners + - commento_postgres_db + - commento_postgres_user + - commento_github_key + - commento_smtp_password + - commento_askimet_key + - commento_postgres_password + - commento_github_secret + host: + from_secret: ssh-host + key: + from_secret: ssh-key + port: + from_secret: ssh-port + script: + - rm -f env-commento + - "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-commento # \"local-docker-registry\"" + - "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-commento # \"registry-password\"" + - "echo \"export COMMENTO_ORIGIN='$${COMMENTO_ORIGIN}'\" >> env-commento # \"commento-origin\"" + - "echo \"export COMMENTO_SMTP_HOST='$${COMMENTO_SMTP_HOST}'\" >> env-commento # \"commento-smtp-host\"" + - "echo \"export COMMENTO_SMTP_PORT='$${COMMENTO_SMTP_PORT}'\" >> env-commento # \"commento-smtp-port\"" + - "echo \"export COMMENTO_SMTP_USERNAME='$${COMMENTO_SMTP_USERNAME}'\" >> env-commento # \"commento-smtp-username\"" + - "echo \"export COMMENTO_SMTP_FROM_ADDRESS='$${COMMENTO_SMTP_FROM_ADDRESS}'\" >> env-commento # \"commento-smtp-from-address\"" + - "echo \"export COMMENTO_FORBID_NEW_OWNERS='$${COMMENTO_FORBID_NEW_OWNERS}'\" >> env-commento # \"commento-forbid-new-owners\"" + - "echo \"export COMMENTO_POSTGRES_DB='$${COMMENTO_POSTGRES_DB}'\" >> env-commento # \"commento-postgres-db\"" + - "echo \"export COMMENTO_POSTGRES_USER='$${COMMENTO_POSTGRES_USER}'\" >> env-commento # \"commento-postgres-user\"" + - "echo \"export COMMENTO_GITHUB_KEY='$${COMMENTO_GITHUB_KEY}'\" >> env-commento # \"commento-github-key\"" + - "echo \"export COMMENTO_SMTP_PASSWORD='$${COMMENTO_SMTP_PASSWORD}'\" >> env-commento # \"commento-smtp-password\"" + - "echo \"export COMMENTO_ASKIMET_KEY='$${COMMENTO_ASKIMET_KEY}'\" >> env-commento # \"commento-askimet-key\"" + - "echo \"export COMMENTO_POSTGRES_PASSWORD='$${COMMENTO_POSTGRES_PASSWORD}'\" >> env-commento # \"commento-postgres-password\"" + - "echo \"export COMMENTO_GITHUB_SECRET='$${COMMENTO_GITHUB_SECRET}'\" >> env-commento # \"commento-github-secret\"" + username: + from_secret: ssh-user + environment: + COMMENTO_ASKIMET_KEY: + from_secret: commento-askimet-key + COMMENTO_FORBID_NEW_OWNERS: + from_secret: commento-forbid-new-owners + COMMENTO_GITHUB_KEY: + from_secret: commento-github-key + COMMENTO_GITHUB_SECRET: + from_secret: commento-github-secret + COMMENTO_ORIGIN: + from_secret: commento-origin + COMMENTO_POSTGRES_DB: + from_secret: commento-postgres-db + COMMENTO_POSTGRES_PASSWORD: + from_secret: commento-postgres-password + COMMENTO_POSTGRES_USER: + from_secret: commento-postgres-user + COMMENTO_SMTP_FROM_ADDRESS: + from_secret: commento-smtp-from-address + COMMENTO_SMTP_HOST: + from_secret: commento-smtp-host + COMMENTO_SMTP_PASSWORD: + from_secret: commento-smtp-password + COMMENTO_SMTP_PORT: + from_secret: commento-smtp-port + COMMENTO_SMTP_USERNAME: + from_secret: commento-smtp-username + LOCAL_DOCKER_REGISTRY: + from_secret: local-docker-registry + REGISTRY_PASSWORD: + from_secret: registry-password + +- name: scp + image: appleboy/drone-scp:1.6.2 + settings: + command_timeout: 2m + host: + from_secret: ssh-host + key: + from_secret: ssh-key + port: + from_secret: ssh-port + source: + - . + target: /stack/commento + username: + from_secret: ssh-user + +- name: wait + image: alpine + commands: + - sleep 15 + +- name: "dockerbuild:" + image: docker:dind + commands: + - set -e + - sh .drone/login.sh + - sh .drone/build.sh + - sh .drone/push.sh + - sh .drone/logout.sh + environment: + LOCAL_DOCKER_REGISTRY: + from_secret: local-docker-registry + REGISTRY_PASSWORD: + from_secret: registry-password + volumes: + - name: dockersock + path: /var/run + +- name: deploy + image: appleboy/drone-ssh:1.6.2 + settings: + envs: + - drone_tag + - drone_commit + - drone_build_number + - drone_repo_name + - drone_repo_namespace + - commento_origin + - commento_smtp_host + - commento_smtp_port + - commento_smtp_username + - commento_smtp_from_address + - commento_forbid_new_owners + - commento_postgres_db + - commento_postgres_user + - commento_github_key + - commento_smtp_password + - commento_askimet_key + - commento_postgres_password + - commento_github_secret + host: + from_secret: ssh-host + key: + from_secret: ssh-key + port: + from_secret: ssh-port + script: + - export COMMENTO_SMTP_PASSWORD=$${COMMENTO_SMTP_PASSWORD} + - export COMMENTO_ASKIMET_KEY=$${COMMENTO_ASKIMET_KEY} + - export COMMENTO_POSTGRES_PASSWORD=$${COMMENTO_POSTGRES_PASSWORD} + - export COMMENTO_GITHUB_SECRET=$${COMMENTO_GITHUB_SECRET} + - export COMMENTO_ORIGIN=$${COMMENTO_ORIGIN} + - export COMMENTO_SMTP_HOST=$${COMMENTO_SMTP_HOST} + - export COMMENTO_SMTP_PORT=$${COMMENTO_SMTP_PORT} + - export COMMENTO_SMTP_USERNAME=$${COMMENTO_SMTP_USERNAME} + - export COMMENTO_SMTP_FROM_ADDRESS=$${COMMENTO_SMTP_FROM_ADDRESS} + - export COMMENTO_FORBID_NEW_OWNERS=$${COMMENTO_FORBID_NEW_OWNERS} + - export COMMENTO_POSTGRES_DB=$${COMMENTO_POSTGRES_DB} + - export COMMENTO_POSTGRES_USER=$${COMMENTO_POSTGRES_USER} + - export COMMENTO_GITHUB_KEY=$${COMMENTO_GITHUB_KEY} + - set -e + - cd /stack/commento + - sh .drone/login.sh + - sh .drone/pull.sh + - sh .drone/deploy.sh + username: + from_secret: ssh-user + environment: + COMMENTO_ASKIMET_KEY: + from_secret: commento-askimet-key + COMMENTO_FORBID_NEW_OWNERS: + from_secret: commento-forbid-new-owners + COMMENTO_GITHUB_KEY: + from_secret: commento-github-key + COMMENTO_GITHUB_SECRET: + from_secret: commento-github-secret + COMMENTO_ORIGIN: + from_secret: commento-origin + COMMENTO_POSTGRES_DB: + from_secret: commento-postgres-db + COMMENTO_POSTGRES_PASSWORD: + from_secret: commento-postgres-password + COMMENTO_POSTGRES_USER: + from_secret: commento-postgres-user + COMMENTO_SMTP_FROM_ADDRESS: + from_secret: commento-smtp-from-address + COMMENTO_SMTP_HOST: + from_secret: commento-smtp-host + COMMENTO_SMTP_PASSWORD: + from_secret: commento-smtp-password + COMMENTO_SMTP_PORT: + from_secret: commento-smtp-port + COMMENTO_SMTP_USERNAME: + from_secret: commento-smtp-username + +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 + +...