--- kind: pipeline type: docker name: register platform: os: linux arch: amd64 clone: disable: true trigger: event: exclude: - promote --- kind: pipeline type: docker name: registry platform: os: linux arch: amd64 clone: disable: true steps: - name: postgres:12.4 image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f commands: - set -e - "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" - "n=0\nwhile :\ndo\n docker pull postgres:12.4 \\\\\n && docker tag postgres:12.4 $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/postgres:12.4 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/postgres:12.4 && break\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"initialise failed\"\n exit 1\n fi\n echo \"retrying..$n\"\n sleep 5\ndone\n" volumes: - name: dockersock path: /var/run - name: guacamole/guacd:1.2.0 image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f commands: - set -e - "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" - "n=0\nwhile :\ndo\n docker pull guacamole/guacd:1.2.0 \\\\\n && docker tag guacamole/guacd:1.2.0 $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/guacamole/guacd:1.2.0 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/guacamole/guacd:1.2.0 && break\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"initialise failed\"\n exit 1\n fi\n echo \"retrying..$n\"\n sleep 5\ndone\n" volumes: - name: dockersock path: /var/run - name: guacamole/guacamole:1.2.0 image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f commands: - set -e - "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" - "n=0\nwhile :\ndo\n docker pull guacamole/guacamole:1.2.0 \\\\\n && docker tag guacamole/guacamole:1.2.0 $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/guacamole/guacamole:1.2.0 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/guacamole/guacamole:1.2.0 && break\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"initialise failed\"\n exit 1\n fi\n echo \"retrying..$n\"\n sleep 5\ndone\n" volumes: - name: dockersock path: /var/run services: - name: docker image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f privileged: true volumes: - name: dockersock path: /var/run - name: ca path: /etc/docker/certs.d - name: daemonjson path: /etc/docker/daemon.json volumes: - name: dockersock temp: {} - name: ca host: path: /etc/docker/certs.d - name: daemonjson host: path: /etc/docker/daemon.json image_pull_secrets: - dockerconfigjson trigger: event: - promote target: - registry --- 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 steps: - name: print env image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea settings: envs: - drone_tag - drone_commit - drone_build_number - drone_repo_name - drone_repo_namespace - postgres_password script: - rm -f env-guacamole - "echo \"export POSTGRES_PASSWORD='$${POSTGRES_PASSWORD}'\" >> env-guacamole # \"postgres-password\"" environment: POSTGRES_PASSWORD: from_secret: postgres-password - name: scp image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47 settings: command_timeout: 2m source: - . target: /stack/guacamole - name: wait image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1 commands: - sleep 15 - name: "dockerbuild:" image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f commands: - set -e - sh .drone/login.sh - sh .drone/build.sh - sh .drone/push.sh - sh .drone/logout.sh volumes: - name: dockersock path: /var/run - name: deploy image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea settings: envs: - drone_tag - drone_commit - drone_build_number - drone_repo_name - drone_repo_namespace - registry_domain - registry_port - registry_password - postgres_password script: - export POSTGRES_PASSWORD=$${POSTGRES_PASSWORD} - export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN} - export REGISTRY_PORT=$${REGISTRY_PORT} - export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD} - set -e - cd /stack/guacamole - "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" - sh .drone/pull.sh - sh .drone/deploy.sh environment: POSTGRES_PASSWORD: from_secret: postgres-password services: - name: docker image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f privileged: true volumes: - name: dockersock path: /var/run - name: ca path: /etc/docker/certs.d - name: daemonjson path: /etc/docker/daemon.json volumes: - name: dockersock temp: {} - name: ca host: path: /etc/docker/certs.d - name: daemonjson host: path: /etc/docker/daemon.json trigger: event: - promote target: - production ...