コード例 #1
0
ファイル: release-runner.py プロジェクト: magnyld/build-tools
def main(options):
    log.info('Loading config from %s' % options.config)
    config = load_config(options.config)

    if config.getboolean('release-runner', 'verbose'):
        log_level=logging.DEBUG
    else:
        log_level=logging.INFO
    logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s",
                        level=log_level)

    check_buildbot()
    check_fabric()

    # Shorthand
    sendchange_master = config.get('release-runner', 'sendchange_master')
    api_root = config.get('api', 'api_root')
    username = config.get('api', 'username')
    password = config.get('api', 'password')
    hg_username = config.get('release-runner', 'hg_username')
    hg_ssh_key = config.get('release-runner', 'hg_ssh_key')
    buildbot_configs = config.get('release-runner', 'buildbot_configs')
    buildbot_configs_branch = config.get('release-runner',
                                         'buildbot_configs_branch')
    buildbotcustom = config.get('release-runner', 'buildbotcustom')
    buildbotcustom_branch = config.get('release-runner',
                                       'buildbotcustom_branch')
    tools = config.get('release-runner', 'tools')
    tools_branch = config.get('release-runner', 'tools_branch')
    masters_json = config.get('release-runner', 'masters_json')
    staging = config.getboolean('release-runner', 'staging')
    sleeptime = config.getint('release-runner', 'sleeptime')
    notify_from = get_config(config, 'release-runner', 'notify_from', None)
    notify_to = get_config(config, 'release-runner', 'notify_to', None)
    ssh_username = get_config(config, 'release-runner', 'ssh_username', None)
    ssh_key = get_config(config, 'release-runner', 'ssh_key', None)
    if isinstance(notify_to, basestring):
        notify_to = [x.strip() for x in notify_to.split(',')]
    smtp_server = get_config(config, 'release-runner', 'smtp_server',
                             'localhost')
    configs_workdir = 'buildbot-configs'
    custom_workdir = 'buildbotcustom'
    tools_workdir = 'tools'
    configs_pushRepo = make_hg_url(HG, get_repo_path(buildbot_configs),
                                   protocol='ssh')
    custom_pushRepo = make_hg_url(HG, get_repo_path(buildbotcustom),
                                  protocol='ssh')
    tools_pushRepo = make_hg_url(HG, get_repo_path(tools), protocol='ssh')

    rr = ReleaseRunner(api_root=api_root, username=username, password=password)

    # Main loop waits for new releases, processes them and exits.
    while True:
        try:
            log.debug('Fetching release requests')
            rr.get_release_requests()
            if rr.new_releases:
                for release in rr.new_releases:
                    log.info('Got a new release request: %s' % release)
                break
            else:
                log.debug('Sleeping for %d seconds before polling again' %
                          sleeptime)
                time.sleep(sleeptime)
        except Exception, e:
            log.error("Caught exception when polling:", exc_info=True)
            sys.exit(5)
コード例 #2
0
        parser.error("Need to provide a master to sendchange to,"
                     " or -d for a dryrun")
    elif not options.branch:
        parser.error("Need to provide a branch to release")
    elif not options.releaseConfigFiles:
        parser.error("Need to provide a release config file")

    logging.basicConfig(level=options.loglevel,
                        format="%(asctime)s : %(levelname)s : %(message)s")

    releaseConfig = None
    test_success = True
    buildNumber = options.buildNumber
    products = []

    check_buildbot()
    if not options.dryrun and not options.skip_reconfig:
        from util.fabric.common import check_fabric, FabricHelper
        check_fabric()

    if options.configs_dir:
        configs_dir = options.configs_dir
        cleanup_configs = False
    else:
        cleanup_configs = True
        configs_dir = mkdtemp()
        remote = make_hg_url(HG, options.configs_repo_url)
        retry(mercurial,
              args=(remote, configs_dir),
              kwargs={'branch': options.configs_branch})
        update(configs_dir, options.configs_branch)
コード例 #3
0
ファイル: release_sanity.py プロジェクト: magnyld/build-tools
        parser.error("Need to provide a master to sendchange to,"
                     " or -d for a dryrun")
    elif not options.branch:
        parser.error("Need to provide a branch to release")
    elif not options.releaseConfigFiles:
        parser.error("Need to provide a release config file")

    logging.basicConfig(level=options.loglevel,
                        format="%(asctime)s : %(levelname)s : %(message)s")

    releaseConfig = None
    test_success = True
    buildNumber = options.buildNumber
    products = []

    check_buildbot()
    if not options.dryrun and not options.skip_reconfig:
        from util.fabric.common import check_fabric, FabricHelper
        check_fabric()

    if options.configs_dir:
        configs_dir = options.configs_dir
        cleanup_configs = False
    else:
        cleanup_configs = True
        configs_dir = mkdtemp()
        remote = make_hg_url(HG, options.configs_repo_url)
        retry(mercurial, args=(remote, configs_dir),
              kwargs={'branch': options.configs_branch})
        update(configs_dir, options.configs_branch)
コード例 #4
0
def main(options):
    log.info('Loading config from %s' % options.config)
    config = load_config(options.config)

    if config.getboolean('release-runner', 'verbose'):
        log_level = logging.DEBUG
    else:
        log_level = logging.INFO
    logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s",
                        level=log_level)
    # Suppress logging of retry(), see bug 925321 for the details
    logging.getLogger("util.retry").setLevel(logging.WARN)

    check_buildbot()
    check_fabric()

    # Shorthand
    sendchange_master = config.get('release-runner', 'sendchange_master')
    api_root = config.get('api', 'api_root')
    username = config.get('api', 'username')
    password = config.get('api', 'password')
    hg_host = config.get('release-runner', 'hg_host')
    hg_username = config.get('release-runner', 'hg_username')
    hg_ssh_key = config.get('release-runner', 'hg_ssh_key')
    buildbot_configs = config.get('release-runner', 'buildbot_configs')
    buildbot_configs_branch = config.get('release-runner',
                                         'buildbot_configs_branch')
    buildbotcustom = config.get('release-runner', 'buildbotcustom')
    buildbotcustom_branch = config.get('release-runner',
                                       'buildbotcustom_branch')
    tools = config.get('release-runner', 'tools')
    tools_branch = config.get('release-runner', 'tools_branch')
    masters_json = config.get('release-runner', 'masters_json')
    staging = config.getboolean('release-runner', 'staging')
    sleeptime = config.getint('release-runner', 'sleeptime')
    notify_from = get_config(config, 'release-runner', 'notify_from', None)
    notify_to = get_config(config, 'release-runner', 'notify_to', None)
    ssh_username = get_config(config, 'release-runner', 'ssh_username', None)
    ssh_key = get_config(config, 'release-runner', 'ssh_key', None)
    if isinstance(notify_to, basestring):
        notify_to = [x.strip() for x in notify_to.split(',')]
    smtp_server = get_config(config, 'release-runner', 'smtp_server',
                             'localhost')
    configs_workdir = 'buildbot-configs'
    custom_workdir = 'buildbotcustom'
    tools_workdir = 'tools'
    if "://" in buildbot_configs and not buildbot_configs.startswith("file"):
        configs_pushRepo = make_hg_url(hg_host,
                                       get_repo_path(buildbot_configs),
                                       protocol='ssh')
    else:
        configs_pushRepo = buildbot_configs
    if "://" in buildbotcustom and not buildbotcustom.startswith("file"):
        custom_pushRepo = make_hg_url(hg_host,
                                      get_repo_path(buildbotcustom),
                                      protocol='ssh')
    else:
        custom_pushRepo = buildbotcustom
    if "://" in tools and not tools.startswith("file"):
        tools_pushRepo = make_hg_url(hg_host,
                                     get_repo_path(tools),
                                     protocol='ssh')
    else:
        tools_pushRepo = tools

    rr = ReleaseRunner(api_root=api_root, username=username, password=password)

    # Main loop waits for new releases, processes them and exits.
    while True:
        try:
            log.debug('Fetching release requests')
            rr.get_release_requests()
            if rr.new_releases:
                for release in rr.new_releases:
                    log.info('Got a new release request: %s' % release)
                break
            else:
                log.debug('Sleeping for %d seconds before polling again' %
                          sleeptime)
                time.sleep(sleeptime)
        except Exception, e:
            log.error("Caught exception when polling:", exc_info=True)
            sys.exit(5)