from buildbot.plugins import changes from buildbot.plugins import schedulers from buildbot.plugins import steps from utils import scummsteps import config import workers max_jobs = getattr(config, 'max_jobs', None) or (multiprocessing.cpu_count() + 1) # Lock to avoid running more than 1 build at the same time on a worker # This lock is used for builder workers to avoid too high CPU load # It's also used for fetcher worker to ensure that fetching will occur just before building # thanks to fetcher being locked all the way through the build process lock_build = util.WorkerLock("worker", maxCount=1) # builds contains all build trees # ccache is the cache for compiled objects used by ccache # src contains the source trees # triggers is some working directory needed by triggers # bshomes is used for various build systems (like Gradle) to avoid downloading things at each run # pollers is used by poll modules to maintain their state for data_dir in ["builds", "ccache", "src", "triggers", "bshomes", "pollers"]: os.makedirs(os.path.join(config.data_dir, data_dir), exist_ok=True) shutil.copyfile(os.path.join(config.configuration_dir, "ccache.conf"), os.path.join(config.data_dir, "ccache", "ccache.conf")) class Build: __slots__ = ['name']
REPOS = [] PROJECT = '{{ homu_github_repo_name }}' for HOST in ['github.com']: for USER in ['{{ homu_github_repo_owner }}', '{{ buildbot_repo_users|join("\', \'") }}']: PATH = '/'.join([USER, PROJECT]) SSH_PATH = ':'.join([HOST, PATH]) HTTPS_PATH = '/'.join([HOST, PATH]) REPOS.append("git@" + SSH_PATH + ".git") REPOS.append("https://" + HTTPS_PATH) REPOS.append("https://" + HTTPS_PATH + ".git") DEFAULT_REPOURL = "{{ buildbot_git_source }}" git_source = GoodRepo(REPOS, DEFAULT_REPOURL) params_lock = util.WorkerLock("fetch-params", maxCount=1) def sh(*argv, **kw): name = kw.pop('name', os.path.basename(argv[0])) haltOnFailure = kw.pop('haltOnFailure', False) locks = kw.pop('locks', []) assert kw == {}, 'Unexpected keywords: {!r}'.format(kw) return steps.ShellCommand( name=name, description=name, command=argv, timeout=None, haltOnFailure=haltOnFailure, locks=locks, )
# -*- python -*- # ex: set filetype=python: from buildbot.plugins import util import common db_lock = util.WorkerLock("db_lock", maxCount=1) def generateDBTestStep(dbname, dbport): mysqlString = "mysql -u root -h 127.0.0.1 -P " + dbport return common.shellSequence( commands=[ common.shellArg(command='echo "select version()" | ' + mysqlString, haltOnFailure=False, logname='version'), common.shellArg(command=util.Interpolate( 'echo "create database opencast%(prop:buildnumber)s;" | ' + mysqlString), haltOnFailure=False, logname='createdb'), common.shellArg(command=util.Interpolate( mysqlString + ' opencast%(prop:buildnumber)s < docs/scripts/ddl/mysql5.sql'), haltOnFailure=False, logname='newdb'), common.shellArg(command=util.Interpolate( 'echo "drop database opencast%(prop:buildnumber)s;" | ' + mysqlString),
import yaml from buildbot.plugins import util WORKER_LOCK = util.WorkerLock('wannet_worker_lock', maxCount=2) def load_yaml(file): with open(file, 'r') as f: try: data = yaml.safe_load(f) return data except yaml.YAMLError as e: print(e)