X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fbuildbot%2Fprojects%2Fnicecoop%2F__init__.py;h=536b424f2592e54d9e383e3867830cb3be7da399;hb=776aa3603903616702b8bc1d9e955d3a6da9ee1e;hpb=c7b16397101fd534c41ede5ae7c55e7e120c06f7;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/buildbot/projects/nicecoop/__init__.py b/modules/private/buildbot/projects/nicecoop/__init__.py deleted file mode 100644 index 536b424..0000000 --- a/modules/private/buildbot/projects/nicecoop/__init__.py +++ /dev/null @@ -1,70 +0,0 @@ -from buildbot.plugins import * -from buildbot_common.build_helpers import * -import os -from buildbot.util import bytes2unicode -import json -from functools import partial - -__all__ = [ "configure", "E" ] - -class E(): - PROJECT = "nicecoop" - BUILDBOT_URL = "https://git.immae.eu/buildbot/{}/".format(PROJECT) - SOCKET = "unix:/run/buildbot/{}.sock".format(PROJECT) - PB_SOCKET = "unix:address=/run/buildbot/{}_pb.sock".format(PROJECT) - SSH_KEY_PATH = "/var/lib/buildbot/buildbot_key" - SSH_HOST_KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIFbhFTl2A2RJn5L51yxJM4XfCS2ZaiSX/jo9jFSdghF" - - GESTION_GIT_URL = "gitolite@git.immae.eu:perso/Immae/Projets/Nicecoop/GestionCompte" - GESTION_RELEASE_PATH = "/var/lib/buildbot/outputs/nicecoop/gestion" - - # master.cfg - SECRETS_FILE = os.getcwd() + "/secrets" - LDAP_URL = "ldaps://ldap.immae.eu:636" - LDAP_ADMIN_USER = "cn=buildbot,ou=services,dc=immae,dc=eu" - LDAP_BASE = "dc=immae,dc=eu" - LDAP_PATTERN = "(uid=%(username)s)" - LDAP_GROUP_PATTERN = "(&(memberOf=cn=groups,ou=immaeEu,cn=buildbot,ou=services,dc=immae,dc=eu)(member=%(dn)s))" - TITLE_URL = "https://www.immae.eu" - TITLE = "Nicecoop" - -def configure(c): - c["buildbotURL"] = E.BUILDBOT_URL - c["www"]["port"] = E.SOCKET - - worker_name = "generic-worker-nicecoop" - c['workers'].append(worker.LocalWorker(worker_name)) - - c['schedulers'].append(git_hook_scheduler("Gestion", ["GestionProduction", "GestionSandbox"])) - c['schedulers'].append(force_scheduler("force_nicecoop", ["GestionProduction", "GestionSandbox"])) - c['builders'].append(util.BuilderConfig(name="GestionProduction", workernames=[worker_name], factory=gestion_factory("production"))) - c['builders'].append(util.BuilderConfig(name="GestionSandbox", workernames=[worker_name], factory=gestion_factory("sandbox"))) - -def gestion_factory(env): - path_env = { - "PATH": "/run/current-system/sw/bin" - } - - factory = util.BuildFactory() - factory.addStep(steps.Git(logEnviron=False, repourl=E.GESTION_GIT_URL, - submodules=True, sshPrivateKey=open(E.SSH_KEY_PATH).read().rstrip(), - sshHostKey=E.SSH_HOST_KEY, mode="full", method="fresh")) - factory.addStep(steps.FileDownload(mastersrc="/run/current-system/nicecoop/gestion/{}.tar.gz".format(env), workerdest="{}.tar.gz".format(env))) - factory.addStep(steps.ShellCommand(name="cleanup files", - logEnviron=False, haltOnFailure=False, command="rm -rf ../{}_app".format(env))) - factory.addStep(steps.ShellCommand(name="extract files", - logEnviron=False, haltOnFailure=True, env=path_env, command="tar -C .. -xzf {}.tar.gz".format(env))) - factory.addStep(steps.ShellCommand(name="make files writeable", - logEnviron=False, haltOnFailure=True, workdir="{}_app".format(env), command="chmod -R u+w .")) - factory.addStep(steps.ShellCommand(name="remove symlinks", - logEnviron=False, haltOnFailure=True, workdir="{}_app".format(env), - command="rm var app/config/parameters.yml")) - factory.addStep(NixShellCommand(name="copy parameters", - logEnviron=False, haltOnFailure=True, env=path_env, - command="cat {0}/parameters.yml | gucci -f /var/secrets/buildbot/nicecoop/{0}.yml > ../{0}_app/app/config/parameters.yml".format(env))) - factory.addStep(steps.ShellCommand(name="test configuration", - logEnviron=False, haltOnFailure=True, workdir="{}_app".format(env), command="./bin/console --env=prod -q")) - factory.addStep(steps.FileUpload(workersrc="../{}_app/app/config/parameters.yml".format(env), - masterdest=E.GESTION_RELEASE_PATH + "/{}/parameters.yml".format(env))) - - return factory