From 7a0f4c3f1267c2aac793901c90840bbe620c750c Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Thu, 22 Oct 2020 21:16:14 +0100 Subject: [PATCH] . --- .drone/drone-home.jsonnet | 43 ++++++++++++++++-------- .drone/drone-home.yml | 70 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 14 deletions(-) diff --git a/.drone/drone-home.jsonnet b/.drone/drone-home.jsonnet index 29bcd4d..b27743f 100644 --- a/.drone/drone-home.jsonnet +++ b/.drone/drone-home.jsonnet @@ -4,31 +4,33 @@ local publicSecrets = import 'lib/public-secrets.libsonnet'; local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet'; local register = import 'node_modules/@sigyl/jsonnet-drone/register.libsonnet'; local registry = import 'node_modules/@sigyl/jsonnet-drone/registry.libsonnet'; +local save = import 'node_modules/@sigyl/jsonnet-drone/save.libsonnet'; local config = { registry: '', }; +local defs = [ + { + load: 'postgres:12.4', + save: 'postgres:12.4' + }, + { + load: 'guacamole/guacd:1.2.0', + save: 'guacamole/guacd:1.2.0', + }, + { + load: 'guacamole/guacamole:1.2.0', + save: 'guacamole/guacamole:1.2.0', + }, +]; [ register, registry( config { // script: 'sh .drone/scripts/initialise-images.sh', secrets: [], - images: [ - { - load: 'postgres:12.4', - save: 'postgres:12.4' - }, - { - load: 'guacamole/guacd:1.2.0', - save: 'guacamole/guacd:1.2.0', - }, - { - load: 'guacamole/guacamole:1.2.0', - save: 'guacamole/guacamole:1.2.0', - }, - ], + images: defs, }, ) { trigger +: { @@ -40,6 +42,19 @@ local config = { ], }, }, + save(config)( + 'guacamole', + defs, + ) { + trigger +: { + event +: [ + 'promote', + ], + target +: [ + 'save', + ], + }, + }, deploy(config)( 'guacamole', '/stack/', diff --git a/.drone/drone-home.yml b/.drone/drone-home.yml index 6654275..ecf9f87 100644 --- a/.drone/drone-home.yml +++ b/.drone/drone-home.yml @@ -94,6 +94,76 @@ kind: pipeline type: docker name: deploy +platform: + os: linux + arch: amd64 + +clone: + disable: true + +steps: +- name: mkdir + image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea + settings: + envs: + - drone_tag + - drone_commit + - drone_build_number + - drone_repo_name + - drone_repo_namespace + script: + - mkdir -p /root/images/guacamole + +- name: postgres:12.4 + image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea + settings: + envs: + - drone_tag + - drone_commit + - drone_build_number + - drone_repo_name + - drone_repo_namespace + 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" + - echo postgres:12.4 + +- name: guacamole/guacd:1.2.0 + image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea + settings: + envs: + - drone_tag + - drone_commit + - drone_build_number + - drone_repo_name + - drone_repo_namespace + 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" + - echo guacamole/guacd:1.2.0 + +- name: guacamole/guacamole:1.2.0 + image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea + settings: + envs: + - drone_tag + - drone_commit + - drone_build_number + - drone_repo_name + - drone_repo_namespace + 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" + - echo guacamole/guacamole:1.2.0 + +trigger: + event: + - promote + target: + - save + +--- +kind: pipeline +type: docker +name: deploy + platform: os: linux arch: amd64