diff --git a/.drone/drone-home.yml b/.drone/drone-home.yml index a24f59c..82c5554 100644 --- a/.drone/drone-home.yml +++ b/.drone/drone-home.yml @@ -12,17 +12,9 @@ steps: image: appleboy/drone-scp settings: command_timeout: 2m - host: - from_secret: ssh-host - key: - from_secret: ssh-key - port: - from_secret: ssh-port source: - . target: /stack/squid - username: - from_secret: ssh-user - name: wait image: alpine @@ -43,12 +35,6 @@ steps: - ssh_root_user - ssh_password - ssh_key - host: - from_secret: ssh-host - password: - from_secret: ssh-password - port: - from_secret: ssh-port script: - set -e - docker network prune -f @@ -69,8 +55,6 @@ steps: - echo "$${SSH_PASSWORD}" - export SSH_KEY="$${SSH_KEY}" - echo "$${SSH_KEY}" - username: - from_secret: ssh-user environment: SSH_HOST: from_secret: ssh-host diff --git a/.drone/lib/images.libsonnet b/.drone/lib/images.libsonnet index 775a01e..062b991 100644 --- a/.drone/lib/images.libsonnet +++ b/.drone/lib/images.libsonnet @@ -1,28 +1,14 @@ local util = import 'util.libsonnet'; +local settings = import 'settings.libsonnet'; { docker: { name: 'docker', image: 'docker:dind', }, - scp(target): { + scp(target): settings.ssh { name: 'scp', image: 'appleboy/drone-scp', - settings: { - host: { - from_secret: 'ssh-host', - }, - username: { - from_secret: 'ssh-user', - }, - /*password: { - from_secret: 'ssh-password', - },*/ - key: { - from_secret: 'ssh-key', - }, - port: { - from_secret: 'ssh-port', - }, + settings +: { command_timeout: '2m', target: target, source: [ @@ -30,13 +16,9 @@ local util = import 'util.libsonnet'; ], }, }, - ssh: { + ssh: settings.ssh { image: 'appleboy/drone-ssh', - settings: { - host: util.fromSecret("ssh-host"), - port: util.fromSecret("ssh-port"), - username: util.fromSecret("ssh-user"), - password: util.fromSecret("ssh-password"), + settings +: { envs: [ 'drone_tag', 'drone_commit', diff --git a/.drone/lib/settings.libsonnet b/.drone/lib/settings.libsonnet new file mode 100644 index 0000000..4981fae --- /dev/null +++ b/.drone/lib/settings.libsonnet @@ -0,0 +1,9 @@ +local util = import 'util.libsonnet'; +{ + ssh: { + host: util.fromSecret('ssh-host'), + port: util.fromSecret('ssh-port'), + username: util.fromSecret('ssh-user'), + key: util.fromSecret('ssh-key'), + }, +} \ No newline at end of file