fix: ssh_username variable

This commit is contained in:
Giles Bradshaw 2020-09-22 12:41:05 +01:00
parent e36f6fe364
commit 2348377415
7 changed files with 19 additions and 32 deletions

View File

@ -42,15 +42,11 @@ steps:
- drone_gitea_server - drone_gitea_server
- drone_server_host - drone_server_host
- ssh_host - ssh_host
- ssh_user - ssh_username
- ssh_port - ssh_port
- drone_gitea_client_secret - drone_gitea_client_secret
- drone_rpc_secret - drone_rpc_secret
- ssh_key - ssh_key
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script: script:
- rm -f env-drone - rm -f env-drone
- "echo \"export REGISTRY_DOMAIN='$${REGISTRY_DOMAIN}'\" >> env-drone # \"registry-domain\"" - "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_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 DRONE_SERVER_HOST='$${DRONE_SERVER_HOST}'\" >> env-drone # \"drone-server-host\""
- "echo \"export SSH_HOST='$${SSH_HOST}'\" >> env-drone # \"ssh-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 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_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 DRONE_RPC_SECRET='$${DRONE_RPC_SECRET}'\" >> env-drone # \"drone-rpc-secret\""
- "echo \"export SSH_KEY='$${SSH_KEY}'\" >> env-drone # \"ssh-key\"" - "echo \"export SSH_KEY='$${SSH_KEY}'\" >> env-drone # \"ssh-key\""
username: ${SSH_USER}
environment: environment:
DOMAIN: DOMAIN:
from_secret: domain from_secret: domain
@ -92,21 +87,16 @@ steps:
from_secret: ssh-key from_secret: ssh-key
SSH_PORT: SSH_PORT:
from_secret: ssh-port from_secret: ssh-port
SSH_USER: SSH_USERNAME:
from_secret: ssh-user from_secret: ssh-username
- name: scp - name: scp
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47 image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
settings: settings:
command_timeout: 2m command_timeout: 2m
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
source: source:
- . - .
target: /stack/drone target: /stack/drone
username: ${SSH_USER}
- name: wait - name: wait
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1 image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
@ -146,7 +136,7 @@ steps:
- drone_gitea_server - drone_gitea_server
- drone_server_host - drone_server_host
- ssh_host - ssh_host
- ssh_user - ssh_username
- ssh_port - ssh_port
- drone_gitea_client_secret - drone_gitea_client_secret
- drone_rpc_secret - drone_rpc_secret
@ -154,10 +144,6 @@ steps:
- registry_domain - registry_domain
- registry_port - registry_port
- registry_password - registry_password
host: ${SSH_HOST}
key: ${SSH_KEY}
passphrase: ${SSH_PASSPHRASE}
port: ${SSH_PORT}
script: script:
- export DRONE_GITEA_CLIENT_SECRET=$${DRONE_GITEA_CLIENT_SECRET} - export DRONE_GITEA_CLIENT_SECRET=$${DRONE_GITEA_CLIENT_SECRET}
- export DRONE_RPC_SECRET=$${DRONE_RPC_SECRET} - export DRONE_RPC_SECRET=$${DRONE_RPC_SECRET}
@ -167,7 +153,7 @@ steps:
- export DRONE_GITEA_SERVER=$${DRONE_GITEA_SERVER} - export DRONE_GITEA_SERVER=$${DRONE_GITEA_SERVER}
- export DRONE_SERVER_HOST=$${DRONE_SERVER_HOST} - export DRONE_SERVER_HOST=$${DRONE_SERVER_HOST}
- export SSH_HOST=$${SSH_HOST} - export SSH_HOST=$${SSH_HOST}
- export SSH_USER=$${SSH_USER} - export SSH_USERNAME=$${SSH_USERNAME}
- export SSH_PORT=$${SSH_PORT} - export SSH_PORT=$${SSH_PORT}
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN} - export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
- export REGISTRY_PORT=$${REGISTRY_PORT} - export REGISTRY_PORT=$${REGISTRY_PORT}
@ -177,7 +163,6 @@ steps:
- sh .drone/login.sh - sh .drone/login.sh
- sh .drone/pull.sh - sh .drone/pull.sh
- sh .drone/deploy.sh - sh .drone/deploy.sh
username: ${SSH_USER}
environment: environment:
DOMAIN: DOMAIN:
from_secret: domain from_secret: domain
@ -203,8 +188,8 @@ steps:
from_secret: ssh-key from_secret: ssh-key
SSH_PORT: SSH_PORT:
from_secret: ssh-port from_secret: ssh-port
SSH_USER: SSH_USERNAME:
from_secret: ssh-user from_secret: ssh-username
services: services:
- name: docker - name: docker

View File

@ -4,6 +4,6 @@
'drone-gitea-server', 'drone-gitea-server',
'drone-server-host', 'drone-server-host',
'ssh-host', 'ssh-host',
'ssh-user', 'ssh-username',
'ssh-port' 'ssh-port'
] ]

View File

@ -4,6 +4,6 @@
"build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream" "build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream"
}, },
"dependencies": { "dependencies": {
"@sigyl/jsonnet-drone": "^0.1.0" "@sigyl/jsonnet-drone": "^0.1.1"
} }
} }

View File

@ -12,10 +12,10 @@
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff" resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff"
integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw== integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw==
"@sigyl/jsonnet-drone@^0.1.0": "@sigyl/jsonnet-drone@^0.1.1":
version "0.1.0" version "0.1.1"
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.0.tgz#feda1797e8e9ef799cad72e65f7163ca26a9e3a5" resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.1.tgz#37afda650e8420a664e89c762236a1e59aa485d9"
integrity sha512-QY/ngucxFOtLfL8Mt0f2bxN4fQDUOGOFtaRpSH2cNyg84xADkzehT0ORZtbLitr+AwhyF5KN/zAGvzkyNAoqPw== integrity sha512-GR7LXYaUJYjkcWRyyLlwrBX9Jw04Vlcc/XS32rNaSz4wtrD9opvnmESxNC1UTWXsT/3ybuQhLhCboEb2GiTWmw==
dependencies: dependencies:
"@sigyl/jsonnet-compose" "^0.0.2" "@sigyl/jsonnet-compose" "^0.0.2"
"@sigyl/jsonnet-drone-environment" "0.0.5" "@sigyl/jsonnet-drone-environment" "0.0.5"

View File

@ -46,7 +46,7 @@ services:
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET} - DRONE_RPC_SECRET=${DRONE_RPC_SECRET}
- DRONE_RUNNER_CAPACITY=8 - DRONE_RUNNER_CAPACITY=8
- DRONE_RUNNER_NAME="docker-runner" - 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: networks:
- appnet - appnet
volumes: volumes:

3
git-hooks/build.sh Normal file
View File

@ -0,0 +1,3 @@
drone jsonnet --source .drone/$1.jsonnet --target .drone/$1.yml --stream \
&& git add .drone/$1.yml \
&& echo .drone/$1.yml \

View File

@ -1,3 +1,2 @@
drone jsonnet --source .drone/drone-home.jsonnet --target .drone/drone-home.yml --stream \ sh git-hooks/build.sh drone-home \
&& git add .drone/drone-home.yml \
&& echo "jsonnet built" && echo "jsonnet built"