2020-08-28 20:57:52 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: register
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
clone:
|
|
|
|
disable: true
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
exclude:
|
|
|
|
- promote
|
|
|
|
|
2020-10-22 17:45:45 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: registry
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
2020-10-23 09:43:56 +00:00
|
|
|
clone:
|
|
|
|
disable: true
|
|
|
|
|
2020-10-22 17:45:45 +00:00
|
|
|
steps:
|
2020-10-23 09:43:56 +00:00
|
|
|
- name: portainer/portainer-ce:2.0.0-alpine
|
|
|
|
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 portainer/portainer-ce:2.0.0-alpine@sha256:5555e1538aa4bc56d7ae85787278e4b972573b205e2ae260717ef17985e0e24f \\\\\n && docker tag portainer/portainer-ce:2.0.0-alpine@sha256:5555e1538aa4bc56d7ae85787278e4b972573b205e2ae260717ef17985e0e24f $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/portainer-ce:2.0.0-alpine \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/portainer-ce:2.0.0-alpine && 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: portainer/agent:2.0.0
|
2020-10-22 17:45:45 +00:00
|
|
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
|
|
|
commands:
|
|
|
|
- set -e
|
2020-10-23 09:43:56 +00:00
|
|
|
- "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 portainer/agent:2.0.0@sha256:8f994457bc32480bff351f0b1d371557238e69f5902037addfe76fa7bd930b9d \\\\\n && docker tag portainer/agent:2.0.0@sha256:8f994457bc32480bff351f0b1d371557238e69f5902037addfe76fa7bd930b9d $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/agent:2.0.0 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/agent:2.0.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"
|
2020-10-22 17:45:45 +00:00
|
|
|
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
|
|
|
|
|
2020-08-28 20:57:52 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2020-10-23 09:43:56 +00:00
|
|
|
name: save
|
2020-08-28 20:57:52 +00:00
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
2020-10-23 09:43:56 +00:00
|
|
|
clone:
|
|
|
|
disable: true
|
|
|
|
|
2020-08-28 20:57:52 +00:00
|
|
|
steps:
|
2020-10-23 09:43:56 +00:00
|
|
|
- name: mkdir
|
2020-08-28 20:57:52 +00:00
|
|
|
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:
|
2020-10-23 09:43:56 +00:00
|
|
|
- mkdir -p /stack/.images/portainer/built
|
|
|
|
- rm -f /stack/.images/portainer/*.*
|
|
|
|
- rm -f /stack/.images/portainer/built/*.*
|
2020-08-28 20:57:52 +00:00
|
|
|
|
2020-10-23 09:43:56 +00:00
|
|
|
- name: portainer/portainer-ce:2.0.0-alpine
|
|
|
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
2020-08-28 20:57:52 +00:00
|
|
|
settings:
|
2020-10-23 09:43:56 +00:00
|
|
|
envs:
|
|
|
|
- drone_tag
|
|
|
|
- drone_commit
|
|
|
|
- drone_build_number
|
|
|
|
- drone_repo_name
|
|
|
|
- drone_repo_namespace
|
|
|
|
- registry_domain
|
|
|
|
- registry_port
|
|
|
|
- registry_password
|
2020-10-24 12:37:41 +00:00
|
|
|
- destination_registry
|
2020-10-23 09:43:56 +00:00
|
|
|
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"
|
|
|
|
- docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/portainer-ce:2.0.0-alpine
|
|
|
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/portainer-ce:2.0.0-alpine -o /stack/.images/portainer/portainer_portainer-ce:2.0.0-alpine.tar
|
2020-10-24 12:37:41 +00:00
|
|
|
- echo "docker load < portainer_portainer-ce:2.0.0-alpine.tar" >> /stack/.images/portainer/load.sh
|
|
|
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/portainer-ce:2.0.0-alpine $${DESTINATION_REGISTRY}/stack/portainer/portainer/portainer-ce:2.0.0-alpine" >> /stack/.images/portainer/load.sh
|
2020-08-28 20:57:52 +00:00
|
|
|
|
2020-10-23 09:43:56 +00:00
|
|
|
- name: portainer/agent:2.0.0
|
2020-08-28 20:57:52 +00:00
|
|
|
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
|
2020-10-24 12:37:41 +00:00
|
|
|
- destination_registry
|
2020-08-28 20:57:52 +00:00
|
|
|
script:
|
2020-10-23 09:43:56 +00:00
|
|
|
- "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"
|
|
|
|
- docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/agent:2.0.0
|
|
|
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/agent:2.0.0 -o /stack/.images/portainer/portainer_agent:2.0.0.tar
|
2020-10-24 12:37:41 +00:00
|
|
|
- echo "docker load < portainer_agent:2.0.0.tar" >> /stack/.images/portainer/load.sh
|
|
|
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/portainer/portainer/agent:2.0.0 $${DESTINATION_REGISTRY}/stack/portainer/portainer/agent:2.0.0" >> /stack/.images/portainer/load.sh
|
2020-10-23 09:43:56 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- save
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: print
|
|
|
|
|
|
|
|
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
|
|
|
|
script:
|
|
|
|
- rm -f env-portainer
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- print
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: build
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: "dockerbuild:"
|
|
|
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
|
|
|
commands:
|
|
|
|
- set -e
|
|
|
|
- export NAME=portainer
|
|
|
|
- export ROOT=stack
|
|
|
|
- "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/build.sh
|
|
|
|
- sh .drone/push.sh
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
2020-08-28 20:57:52 +00:00
|
|
|
|
|
|
|
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
|
2020-10-22 17:45:45 +00:00
|
|
|
- name: daemonjson
|
|
|
|
path: /etc/docker/daemon.json
|
2020-08-28 20:57:52 +00:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
temp: {}
|
|
|
|
- name: ca
|
|
|
|
host:
|
|
|
|
path: /etc/docker/certs.d
|
2020-10-22 17:45:45 +00:00
|
|
|
- name: daemonjson
|
|
|
|
host:
|
|
|
|
path: /etc/docker/daemon.json
|
2020-08-28 20:57:52 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
2020-10-23 09:43:56 +00:00
|
|
|
- build
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: deploy
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: scp
|
|
|
|
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
|
|
|
settings:
|
|
|
|
command_timeout: 2m
|
|
|
|
source:
|
|
|
|
- .
|
|
|
|
target: /stack/portainer
|
|
|
|
|
|
|
|
- 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
|
|
|
|
- domain
|
|
|
|
- registry_domain
|
|
|
|
- registry_port
|
|
|
|
- registry_password
|
|
|
|
script:
|
|
|
|
- export DOMAIN=$${DOMAIN}
|
|
|
|
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
|
|
|
|
- export REGISTRY_PORT=$${REGISTRY_PORT}
|
|
|
|
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
|
|
|
- set -e
|
|
|
|
- export NAME=portainer
|
|
|
|
- export ROOT=stack
|
|
|
|
- cd /stack/portainer
|
|
|
|
- "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
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- deploy
|
2020-08-28 20:57:52 +00:00
|
|
|
- production
|
|
|
|
|
|
|
|
...
|