コード例 #1
0
ファイル: jobs.py プロジェクト: xzased/ci_scripts
def reconfig(args):
    if not args.token:
        print('Please set the correct GITHUB_TOKEN in your env.')
        sys.exit(1)
    conn = connection(args.username, args.password)
    repos = DIRECTORIES.keys()
    repos.sort()
    context = {
        'run': RUN,
        'fail': FAIL,
        'project_list': ','.join([j.name for j in TESTS]),
        'repos': repos,
        'token': args.token,
    }
    tests = TESTS + [PullRunner(TESTS)]
    for test in tests:
        template = ENV.get_template(test.template)
        config = template.render(test=test, **context)
        if args.dry:
            with open(config_filename(test.name), 'w') as conf:
                conf.write(config)
        else:
            try:
                conn.reconfig_job(test.name, config)
            except:
                conn.create_job(test.name, config)
コード例 #2
0
ファイル: jobs.py プロジェクト: rmyers/ci_scripts
def reconfig(args):
    if not args.token:
        print('Please set the correct GITHUB_TOKEN in your env.')
        sys.exit(1)
    conn = connection(args.username, args.password)
    repos = DIRECTORIES.keys()
    repos.sort()
    context = {
        'run': contents('run.py'),
        'fail': contents('fail.py'),
        'project_list': ','.join([j.name for j in PR_TESTS]),
        'repos': repos,
        'token': args.token,
        'username': args.username,
        'last_modified': str(datetime.datetime.now())
    }
    tests = TRUNK_TESTS + PR_TESTS + [PullRunner(PR_TESTS)]
    for test in tests:
        template = ENV.get_template(test.template)
        config = template.render(test=test, **context)
        with open(config_filename(test.name), 'w') as conf:
            conf.write(config)

        if not args.dry:
            try:
                conn.reconfig_job(test.name, config)
            except:
                conn.create_job(test.name, config)