mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-31 01:10:20 -06:00
Merge pull request #1489 from owncloud/continuous_deployment
continuous deployment
This commit is contained in:
127
.drone.star
127
.drone.star
@@ -185,8 +185,7 @@ def main(ctx):
|
||||
build_release_helpers = [
|
||||
changelog(ctx),
|
||||
docs(ctx),
|
||||
refreshDockerBadges(ctx),
|
||||
updateDeployment(ctx),
|
||||
refreshDockerBadges(ctx)
|
||||
]
|
||||
|
||||
if ctx.build.event == "cron":
|
||||
@@ -195,7 +194,7 @@ def main(ctx):
|
||||
purgeBuildArtifactCache(ctx, 'ocis-binary-amd64'),
|
||||
testPipelines(ctx)
|
||||
)
|
||||
]
|
||||
] + example_deploys(ctx)
|
||||
|
||||
elif \
|
||||
(ctx.build.event == "pull_request" and '[docs-only]' in ctx.build.title) \
|
||||
@@ -214,6 +213,14 @@ def main(ctx):
|
||||
|
||||
pipelines = test_pipelines + build_release_pipelines + build_release_helpers
|
||||
|
||||
|
||||
pipelines = \
|
||||
pipelines + \
|
||||
pipelinesDependsOn(
|
||||
example_deploys(ctx),
|
||||
pipelines
|
||||
)
|
||||
|
||||
# always append notification step
|
||||
pipelines.append(
|
||||
pipelineDependsOn(
|
||||
@@ -1266,39 +1273,6 @@ def makeGenerate(module):
|
||||
}
|
||||
]
|
||||
|
||||
def updateDeployment(ctx):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'updateDeployment',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'webhook',
|
||||
'image': 'plugins/webhook:1',
|
||||
'settings': {
|
||||
'username': {
|
||||
'from_secret': 'webhook_username',
|
||||
},
|
||||
'password': {
|
||||
'from_secret': 'webhook_password',
|
||||
},
|
||||
'method': 'GET',
|
||||
'urls': 'https://ocis.owncloud.works/hooks/update-ocis',
|
||||
}
|
||||
}
|
||||
],
|
||||
'depends_on': getPipelineNames(dockerReleases(ctx) + binaryReleases(ctx)),
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
def notify(ctx):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
@@ -1460,6 +1434,87 @@ def build():
|
||||
},
|
||||
]
|
||||
|
||||
def example_deploys(ctx):
|
||||
latest_configs = [
|
||||
'cs3_users_ocis/latest.yml',
|
||||
'ocis_keycloak/latest.yml',
|
||||
'ocis_traefik/latest.yml',
|
||||
]
|
||||
released_configs = [
|
||||
'cs3_users_ocis/released.yml',
|
||||
'ocis_keycloak/released.yml',
|
||||
'ocis_traefik/released.yml',
|
||||
]
|
||||
|
||||
# if on master branch:
|
||||
configs = latest_configs
|
||||
rebuild = "false"
|
||||
|
||||
if ctx.build.event == "tag":
|
||||
configs = released_configs
|
||||
rebuild = 'false'
|
||||
|
||||
if ctx.build.event == "cron":
|
||||
configs = latest_configs + released_configs
|
||||
rebuild = 'true'
|
||||
|
||||
deploys = []
|
||||
for config in configs:
|
||||
deploys.append(deploy(ctx, config, rebuild))
|
||||
|
||||
return deploys
|
||||
|
||||
def deploy(ctx, config, rebuild):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'deploy_%s' % (config),
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'clone continuous deployment playbook',
|
||||
'image': 'alpine/git',
|
||||
'commands': [
|
||||
'cd deployments/continuous-deployment-config',
|
||||
'git clone https://github.com/owncloud-devops/continuous-deployment.git',
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'deploy',
|
||||
'image': 'owncloudci/drone-ansible',
|
||||
'failure': 'ignore',
|
||||
'environment': {
|
||||
'CONTINUOUS_DEPLOY_SERVERS_CONFIG': '../%s' % (config),
|
||||
"REBUILD": '%s' % (rebuild),
|
||||
'HCLOUD_API_TOKEN': {
|
||||
'from_secret': 'hcloud_api_token'
|
||||
},
|
||||
'CLOUDFLARE_API_TOKEN': {
|
||||
'from_secret': 'cloudflare_api_token'
|
||||
}
|
||||
},
|
||||
'settings': {
|
||||
'playbook': 'deployments/continuous-deployment-config/continuous-deployment/playbook-all.yml',
|
||||
'galaxy': 'deployments/continuous-deployment-config/continuous-deployment/requirements.yml',
|
||||
'requirements': 'deployments/continuous-deployment-config/continuous-deployment/py-requirements.txt',
|
||||
'inventory': 'localhost',
|
||||
'private_key': {
|
||||
'from_secret': 'ssh_private_key'
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/v*',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
def genericCache(name, action, mounts, cache_key):
|
||||
rebuild = 'false'
|
||||
restore = 'false'
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: continuous-deployment-ocis-cs3-users-latest
|
||||
server:
|
||||
server_type: cx21
|
||||
image: ubuntu-20.04
|
||||
location: nbg1
|
||||
initial_ssh_key_names:
|
||||
- owncloud-ocis@drone.owncloud.com
|
||||
labels:
|
||||
owner: wkloucek
|
||||
for: oCIS-continuous-deployment-examples
|
||||
rebuild: $REBUILD
|
||||
|
||||
domains:
|
||||
- "*.ocis-cs3-users.latest.owncloud.works"
|
||||
|
||||
vars:
|
||||
docker_compose_projects:
|
||||
- name: ocis
|
||||
git_url: https://github.com/owncloud/ocis.git
|
||||
ref: master
|
||||
docker_compose_path: deployments/examples/cs3_users_ocis
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: wkloucek@owncloud.com
|
||||
OCIS_DOCKER_TAG: latest
|
||||
OCIS_DOMAIN: ocis.ocis-cs3-users.latest.owncloud.works
|
||||
LDAP_MANAGER_DOMAIN: ldap.ocis-keycloak.released.owncloud.works
|
||||
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
|
||||
- name: monitoring
|
||||
git_url: https://github.com/owncloud-devops/monitoring-tracing-client.git
|
||||
ref: master
|
||||
env:
|
||||
NETWORK_NAME: ocis-net
|
||||
TELEMETRY_SERVE_DOMAIN: telemetry.ocis-traefik.latest.owncloud.works
|
||||
JAEGER_COLLECTOR: jaeger-collector.infra.owncloud.works:443
|
||||
TELEGRAF_SPECIFIC_CONFIG: ocis_single_container
|
||||
OCIS_URL: ocis.ocis-cs3-users.latest.owncloud.works
|
||||
OCIS_DEPLOYMENT_ID: continuous-deployment-ocis-cs3-users-latest
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: continuous-deployment-ocis-cs3-users-released
|
||||
server:
|
||||
server_type: cx21
|
||||
image: ubuntu-20.04
|
||||
location: nbg1
|
||||
initial_ssh_key_names:
|
||||
- owncloud-ocis@drone.owncloud.com
|
||||
labels:
|
||||
owner: wkloucek
|
||||
for: oCIS-continuous-deployment-examples
|
||||
rebuild: $REBUILD
|
||||
|
||||
domains:
|
||||
- "*.ocis-cs3-users.released.owncloud.works"
|
||||
|
||||
vars:
|
||||
docker_compose_projects:
|
||||
- name: ocis
|
||||
git_url: https://github.com/owncloud/ocis.git
|
||||
ref: master
|
||||
docker_compose_path: deployments/examples/cs3_users_ocis
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: wkloucek@owncloud.com
|
||||
OCIS_DOCKER_TAG: 1
|
||||
OCIS_DOMAIN: ocis.ocis-cs3-users.released.owncloud.works
|
||||
LDAP_MANAGER_DOMAIN: ldap.ocis-keycloak.released.owncloud.works
|
||||
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
|
||||
- name: monitoring
|
||||
git_url: https://github.com/owncloud-devops/monitoring-tracing-client.git
|
||||
ref: master
|
||||
env:
|
||||
NETWORK_NAME: ocis-net
|
||||
TELEMETRY_SERVE_DOMAIN: telemetry.ocis-traefik.released.owncloud.works
|
||||
JAEGER_COLLECTOR: jaeger-collector.infra.owncloud.works:443
|
||||
TELEGRAF_SPECIFIC_CONFIG: ocis_single_container
|
||||
OCIS_URL: ocis.ocis-cs3-users.released.owncloud.works
|
||||
OCIS_DEPLOYMENT_ID: continuous-deployment-ocis-cs3-users-released
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: continuous-deployment-ocis-keycloak-latest
|
||||
server:
|
||||
server_type: cx21
|
||||
image: ubuntu-20.04
|
||||
location: nbg1
|
||||
initial_ssh_key_names:
|
||||
- owncloud-ocis@drone.owncloud.com
|
||||
labels:
|
||||
owner: wkloucek
|
||||
for: oCIS-continuous-deployment-examples
|
||||
rebuild: $REBUILD
|
||||
|
||||
domains:
|
||||
- "*.ocis-keycloak.latest.owncloud.works"
|
||||
|
||||
vars:
|
||||
docker_compose_projects:
|
||||
- name: ocis
|
||||
git_url: https://github.com/owncloud/ocis.git
|
||||
ref: master
|
||||
docker_compose_path: deployments/examples/ocis_keycloak
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: wkloucek@owncloud.com
|
||||
OCIS_DOCKER_TAG: latest
|
||||
OCIS_DOMAIN: ocis.ocis-keycloak.latest.owncloud.works
|
||||
KEYCLOAK_DOMAIN: keycloak.ocis-keycloak.latest.owncloud.works
|
||||
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
|
||||
- name: monitoring
|
||||
git_url: https://github.com/owncloud-devops/monitoring-tracing-client.git
|
||||
ref: master
|
||||
env:
|
||||
NETWORK_NAME: ocis-net
|
||||
TELEMETRY_SERVE_DOMAIN: telemetry.ocis-keycloak.latest.owncloud.works
|
||||
JAEGER_COLLECTOR: jaeger-collector.infra.owncloud.works:443
|
||||
TELEGRAF_SPECIFIC_CONFIG: ocis_single_container
|
||||
OCIS_URL: ocis.ocis-keycloak.latest.owncloud.works
|
||||
OCIS_DEPLOYMENT_ID: continuous-deployment-ocis-keycloak-latest
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: continuous-deployment-ocis-keycloak-released
|
||||
server:
|
||||
server_type: cx21
|
||||
image: ubuntu-20.04
|
||||
location: nbg1
|
||||
initial_ssh_key_names:
|
||||
- owncloud-ocis@drone.owncloud.com
|
||||
labels:
|
||||
owner: wkloucek
|
||||
for: oCIS-continuous-deployment-examples
|
||||
rebuild: $REBUILD
|
||||
|
||||
domains:
|
||||
- "*.ocis-keycloak.released.owncloud.works"
|
||||
|
||||
vars:
|
||||
docker_compose_projects:
|
||||
- name: ocis
|
||||
git_url: https://github.com/owncloud/ocis.git
|
||||
ref: master
|
||||
docker_compose_path: deployments/examples/ocis_keycloak
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: wkloucek@owncloud.com
|
||||
OCIS_DOCKER_TAG: 1
|
||||
OCIS_DOMAIN: ocis.ocis-keycloak.released.owncloud.works
|
||||
KEYCLOAK_DOMAIN: keycloak.ocis-keycloak.latest.owncloud.works
|
||||
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
|
||||
- name: monitoring
|
||||
git_url: https://github.com/owncloud-devops/monitoring-tracing-client.git
|
||||
ref: master
|
||||
env:
|
||||
NETWORK_NAME: ocis-net
|
||||
TELEMETRY_SERVE_DOMAIN: telemetry.ocis-keycloak.released.owncloud.works
|
||||
JAEGER_COLLECTOR: jaeger-collector.infra.owncloud.works:443
|
||||
TELEGRAF_SPECIFIC_CONFIG: ocis_single_container
|
||||
OCIS_URL: ocis.ocis-keycloak.released.owncloud.works
|
||||
OCIS_DEPLOYMENT_ID: continuous-deployment-ocis-keycloak-released
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
- name: continuous-deployment-ocis-traefik-latest
|
||||
server:
|
||||
server_type: cx21
|
||||
image: ubuntu-20.04
|
||||
location: nbg1
|
||||
initial_ssh_key_names:
|
||||
- owncloud-ocis@drone.owncloud.com
|
||||
labels:
|
||||
owner: wkloucek
|
||||
for: oCIS-continuous-deployment-examples
|
||||
rebuild: $REBUILD
|
||||
|
||||
domains:
|
||||
- "*.ocis-traefik.latest.owncloud.works"
|
||||
|
||||
vars:
|
||||
docker_compose_projects:
|
||||
- name: ocis
|
||||
git_url: https://github.com/owncloud/ocis.git
|
||||
ref: master
|
||||
docker_compose_path: deployments/examples/ocis_traefik
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: wkloucek@owncloud.com
|
||||
OCIS_DOCKER_TAG: latest
|
||||
OCIS_DOMAIN: ocis.ocis-traefik.latest.owncloud.works
|
||||
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
|
||||
- name: monitoring
|
||||
git_url: https://github.com/owncloud-devops/monitoring-tracing-client.git
|
||||
ref: master
|
||||
env:
|
||||
NETWORK_NAME: ocis-net
|
||||
TELEMETRY_SERVE_DOMAIN: telemetry.ocis-traefik.latest.owncloud.works
|
||||
JAEGER_COLLECTOR: jaeger-collector.infra.owncloud.works:443
|
||||
TELEGRAF_SPECIFIC_CONFIG: ocis_single_container
|
||||
OCIS_URL: ocis.ocis-traefik.latest.owncloud.works
|
||||
OCIS_DEPLOYMENT_ID: continuous-deployment-ocis-traefik-latest
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
- name: continuous-deployment-ocis-traefik-released
|
||||
server:
|
||||
server_type: cx21
|
||||
image: ubuntu-20.04
|
||||
location: nbg1
|
||||
initial_ssh_key_names:
|
||||
- owncloud-ocis@drone.owncloud.com
|
||||
labels:
|
||||
owner: wkloucek
|
||||
for: oCIS-continuous-deployment-examples
|
||||
rebuild: $REBUILD
|
||||
|
||||
domains:
|
||||
- "*.ocis-traefik.released.owncloud.works"
|
||||
|
||||
vars:
|
||||
docker_compose_projects:
|
||||
- name: ocis
|
||||
git_url: https://github.com/owncloud/ocis.git
|
||||
ref: master
|
||||
docker_compose_path: deployments/examples/ocis_traefik
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: wkloucek@owncloud.com
|
||||
OCIS_DOCKER_TAG: 1
|
||||
OCIS_DOMAIN: ocis.ocis-traefik.released.owncloud.works
|
||||
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
|
||||
- name: monitoring
|
||||
git_url: https://github.com/owncloud-devops/monitoring-tracing-client.git
|
||||
ref: master
|
||||
env:
|
||||
NETWORK_NAME: ocis-net
|
||||
TELEMETRY_SERVE_DOMAIN: telemetry.ocis-traefik.released.owncloud.works
|
||||
JAEGER_COLLECTOR: jaeger-collector.infra.owncloud.works:443
|
||||
TELEGRAF_SPECIFIC_CONFIG: ocis_single_container
|
||||
OCIS_URL: ocis.ocis-traefik.released.owncloud.works
|
||||
OCIS_DEPLOYMENT_ID: continuous-deployment-ocis-traefik-released
|
||||
@@ -5,7 +5,7 @@ services:
|
||||
traefik:
|
||||
image: "traefik:v2.3"
|
||||
networks:
|
||||
default:
|
||||
ocis-net:
|
||||
aliases:
|
||||
- ${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
command:
|
||||
@@ -44,6 +44,8 @@ services:
|
||||
|
||||
ocis:
|
||||
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
|
||||
networks:
|
||||
ocis-net:
|
||||
depends_on:
|
||||
- ldap-server
|
||||
environment:
|
||||
@@ -94,6 +96,8 @@ services:
|
||||
|
||||
ldap-server:
|
||||
image: osixia/openldap:latest
|
||||
networks:
|
||||
ocis-net:
|
||||
command: --copy-service --loglevel debug
|
||||
environment:
|
||||
LDAP_TLS_VERIFY_CLIENT: never
|
||||
@@ -113,6 +117,8 @@ services:
|
||||
|
||||
ldap-manager:
|
||||
image: osixia/phpldapadmin:0.9.0
|
||||
networks:
|
||||
ocis-net:
|
||||
environment:
|
||||
PHPLDAPADMIN_LDAP_HOSTS: ldap-server
|
||||
PHPLDAPADMIN_HTTPS: "false"
|
||||
@@ -135,3 +141,6 @@ services:
|
||||
volumes:
|
||||
certs:
|
||||
ocis-data:
|
||||
|
||||
networks:
|
||||
ocis-net:
|
||||
Reference in New Issue
Block a user