diff --git a/.drone/drone-home.yml b/.drone/drone-home.yml index cecb19b..1d6b56b 100644 --- a/.drone/drone-home.yml +++ b/.drone/drone-home.yml @@ -42,15 +42,11 @@ steps: - drone_gitea_server - drone_server_host - ssh_host - - ssh_user + - ssh_username - ssh_port - drone_gitea_client_secret - drone_rpc_secret - ssh_key - host: ${SSH_HOST} - key: ${SSH_KEY} - passphrase: ${SSH_PASSPHRASE} - port: ${SSH_PORT} script: - rm -f env-drone - "echo \"export REGISTRY_DOMAIN='$${REGISTRY_DOMAIN}'\" >> env-drone # \"registry-domain\"" @@ -61,12 +57,11 @@ steps: - "echo \"export DRONE_GITEA_SERVER='$${DRONE_GITEA_SERVER}'\" >> env-drone # \"drone-gitea-server\"" - "echo \"export DRONE_SERVER_HOST='$${DRONE_SERVER_HOST}'\" >> env-drone # \"drone-server-host\"" - "echo \"export SSH_HOST='$${SSH_HOST}'\" >> env-drone # \"ssh-host\"" - - "echo \"export SSH_USER='$${SSH_USER}'\" >> env-drone # \"ssh-user\"" + - "echo \"export SSH_USERNAME='$${SSH_USERNAME}'\" >> env-drone # \"ssh-username\"" - "echo \"export SSH_PORT='$${SSH_PORT}'\" >> env-drone # \"ssh-port\"" - "echo \"export DRONE_GITEA_CLIENT_SECRET='$${DRONE_GITEA_CLIENT_SECRET}'\" >> env-drone # \"drone-gitea-client-secret\"" - "echo \"export DRONE_RPC_SECRET='$${DRONE_RPC_SECRET}'\" >> env-drone # \"drone-rpc-secret\"" - "echo \"export SSH_KEY='$${SSH_KEY}'\" >> env-drone # \"ssh-key\"" - username: ${SSH_USER} environment: DOMAIN: from_secret: domain @@ -92,21 +87,16 @@ steps: from_secret: ssh-key SSH_PORT: from_secret: ssh-port - SSH_USER: - from_secret: ssh-user + SSH_USERNAME: + from_secret: ssh-username - name: scp image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47 settings: command_timeout: 2m - host: ${SSH_HOST} - key: ${SSH_KEY} - passphrase: ${SSH_PASSPHRASE} - port: ${SSH_PORT} source: - . target: /stack/drone - username: ${SSH_USER} - name: wait image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1 @@ -146,7 +136,7 @@ steps: - drone_gitea_server - drone_server_host - ssh_host - - ssh_user + - ssh_username - ssh_port - drone_gitea_client_secret - drone_rpc_secret @@ -154,10 +144,6 @@ steps: - registry_domain - registry_port - registry_password - host: ${SSH_HOST} - key: ${SSH_KEY} - passphrase: ${SSH_PASSPHRASE} - port: ${SSH_PORT} script: - export DRONE_GITEA_CLIENT_SECRET=$${DRONE_GITEA_CLIENT_SECRET} - export DRONE_RPC_SECRET=$${DRONE_RPC_SECRET} @@ -167,7 +153,7 @@ steps: - export DRONE_GITEA_SERVER=$${DRONE_GITEA_SERVER} - export DRONE_SERVER_HOST=$${DRONE_SERVER_HOST} - export SSH_HOST=$${SSH_HOST} - - export SSH_USER=$${SSH_USER} + - export SSH_USERNAME=$${SSH_USERNAME} - export SSH_PORT=$${SSH_PORT} - export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN} - export REGISTRY_PORT=$${REGISTRY_PORT} @@ -177,7 +163,6 @@ steps: - sh .drone/login.sh - sh .drone/pull.sh - sh .drone/deploy.sh - username: ${SSH_USER} environment: DOMAIN: from_secret: domain @@ -203,8 +188,8 @@ steps: from_secret: ssh-key SSH_PORT: from_secret: ssh-port - SSH_USER: - from_secret: ssh-user + SSH_USERNAME: + from_secret: ssh-username services: - name: docker diff --git a/.drone/lib/public-secrets.libsonnet b/.drone/lib/public-secrets.libsonnet index 60f7fea..bb253d7 100644 --- a/.drone/lib/public-secrets.libsonnet +++ b/.drone/lib/public-secrets.libsonnet @@ -4,6 +4,6 @@ 'drone-gitea-server', 'drone-server-host', 'ssh-host', - 'ssh-user', + 'ssh-username', 'ssh-port' ] diff --git a/.drone/package.json b/.drone/package.json index 22cfdd2..33bc5f1 100644 --- a/.drone/package.json +++ b/.drone/package.json @@ -4,6 +4,6 @@ "build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream" }, "dependencies": { - "@sigyl/jsonnet-drone": "^0.1.0" + "@sigyl/jsonnet-drone": "^0.1.1" } } diff --git a/.drone/yarn.lock b/.drone/yarn.lock index 44ab354..35ba3cd 100644 --- a/.drone/yarn.lock +++ b/.drone/yarn.lock @@ -12,10 +12,10 @@ resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff" integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw== -"@sigyl/jsonnet-drone@^0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.0.tgz#feda1797e8e9ef799cad72e65f7163ca26a9e3a5" - integrity sha512-QY/ngucxFOtLfL8Mt0f2bxN4fQDUOGOFtaRpSH2cNyg84xADkzehT0ORZtbLitr+AwhyF5KN/zAGvzkyNAoqPw== +"@sigyl/jsonnet-drone@^0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.1.tgz#37afda650e8420a664e89c762236a1e59aa485d9" + integrity sha512-GR7LXYaUJYjkcWRyyLlwrBX9Jw04Vlcc/XS32rNaSz4wtrD9opvnmESxNC1UTWXsT/3ybuQhLhCboEb2GiTWmw== dependencies: "@sigyl/jsonnet-compose" "^0.0.2" "@sigyl/jsonnet-drone-environment" "0.0.5" diff --git a/docker-compose.yml b/docker-compose.yml index 3d4d08e..8856834 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,7 +46,7 @@ services: - DRONE_RPC_SECRET=${DRONE_RPC_SECRET} - DRONE_RUNNER_CAPACITY=8 - DRONE_RUNNER_NAME="docker-runner" - - DRONE_RUNNER_ENVIRON=DOMAIN:$DOMAIN,REGISTRY_DOMAIN:$REGISTRY_DOMAIN,REGISTRY_PORT:$REGISTRY_PORT,REGISTRY_PASSWORD:$REGISTRY_PASSWORD,SSH_HOST:$SSH_HOST,SSH_PORT:$SSH_PORT,SSH_USER:$SSH_USER,SSH_KEY:$SSH_KEY + - DRONE_RUNNER_ENVIRON=DOMAIN:$DOMAIN,REGISTRY_DOMAIN:$REGISTRY_DOMAIN,REGISTRY_PORT:$REGISTRY_PORT,REGISTRY_PASSWORD:$REGISTRY_PASSWORD,SSH_HOST:$SSH_HOST,SSH_PORT:$SSH_PORT,SSH_USERNAME:$SSH_USERNAME,SSH_KEY:$SSH_KEY networks: - appnet volumes: diff --git a/git-hooks/build.sh b/git-hooks/build.sh new file mode 100644 index 0000000..02a4c0b --- /dev/null +++ b/git-hooks/build.sh @@ -0,0 +1,3 @@ +drone jsonnet --source .drone/$1.jsonnet --target .drone/$1.yml --stream \ +&& git add .drone/$1.yml \ +&& echo .drone/$1.yml \ diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index 7161ae2..9aa4fc4 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -1,3 +1,2 @@ -drone jsonnet --source .drone/drone-home.jsonnet --target .drone/drone-home.yml --stream \ -&& git add .drone/drone-home.yml \ +sh git-hooks/build.sh drone-home \ && echo "jsonnet built" \ No newline at end of file