示例#1
0
def main(name=None, config_path=None):
    if name not in (None, '__main__'):
        return

    config = setup_config(config_path)
    setup_logging(config['verbose'])

    task = get_task(config)
    validate_task_schema(config, task)

    server = get_task_server(task, config)
    balrog_auth, config = update_config(config, server)

    config['upstream_artifacts'] = get_upstream_artifacts(task)

    # hacking the tools repo dependency by first reading its location from
    # the config file and only then loading the module from subdfolder
    sys.path.insert(0, os.path.join(config['tools_location'], 'lib/python'))
    # Until we get rid of our tools dep, this import(s) will break flake8 E402
    from util.retry import retry  # noqa: E402

    # Read the manifest from disk
    manifest = get_manifest(config)

    for e in manifest:
        # Get release metadata from manifest
        submitter, release = create_submitter(e, balrog_auth, config)
        # Connect to balrog and submit the metadata
        retry(lambda: submitter.run(**release))
示例#2
0
def test_release_get_manifest(release_task, release_config):
    upstream_artifacts = get_upstream_artifacts(release_task)

    # munge the path with a fake path
    upstream_artifacts[0]["paths"][0] += "munged_path_entry"
    with pytest.raises(SystemExit) as e:
        get_manifest(release_config, upstream_artifacts)
        assert e.type == SystemExit
        assert e.value.code == 3
示例#3
0
def test_release_get_manifest(release_config):
    task = get_task(release_config)
    upstream_artifacts = get_upstream_artifacts(task)

    # munge the path with a fake path
    upstream_artifacts[0]['paths'][0] += 'munged_path_entry'
    with pytest.raises(SystemExit) as e:
        get_manifest(release_config, upstream_artifacts)
        assert e.type == SystemExit
        assert e.value.code == 3
def test_release_get_manifest(release_config):
    task = get_task(release_config)
    upstream_artifacts = get_upstream_artifacts(task)

    # munge the path with a fake path
    upstream_artifacts[0]['paths'][0] += 'munged_path_entry'
    with pytest.raises(SystemExit) as e:
        get_manifest(release_config, upstream_artifacts)
        assert e.type == SystemExit
        assert e.value.code == 3
示例#5
0
def submit_locale(task, config, balrog_auth):
    """Submit a release blob to balrog."""
    from util.retry import retry  # noqa: E402
    upstream_artifacts = get_upstream_artifacts(task)

    # Read the manifest from disk
    manifest = get_manifest(config, upstream_artifacts)

    for e in manifest:
        # Get release metadata from manifest
        submitter, release = create_locale_submitter(e, balrog_auth, config)
        # Connect to balrog and submit the metadata
        retry(lambda: submitter.run(**release))
示例#6
0
def submit_locale(task, config, auth0_secrets):
    """Submit a release blob to balrog."""
    upstream_artifacts = get_upstream_artifacts(task)

    # Read the manifest from disk
    manifest = get_manifest(config, upstream_artifacts)

    suffixes = task['payload'].get('suffixes', [''])

    for e in manifest:
        for suffix in suffixes:
            # Get release metadata from manifest
            submitter, release = create_locale_submitter(e, suffix, auth0_secrets, config)
            # Connect to balrog and submit the metadata
            retry(lambda: submitter.run(**release), jitter=5, sleeptime=10, max_sleeptime=30, attempts=20)
def test_nightly_get_manifest(nightly_config, expected_manifest):
    task = get_task(nightly_config)
    upstream_artifacts = get_upstream_artifacts(task)

    manifest = get_manifest(nightly_config, upstream_artifacts)
    assert manifest == expected_manifest
def test_get_upstream_artifacts(nightly_config, expected):
    task = get_task(nightly_config)
    assert get_upstream_artifacts(task) == expected
示例#9
0
def test_get_upstream_artifacts(nightly_task, nightly_config, expected):
    assert get_upstream_artifacts(nightly_task) == expected
def test_nightly_get_manifest(nightly_config, expected_manifest):
    task = get_task(nightly_config)
    upstream_artifacts = get_upstream_artifacts(task)

    manifest = get_manifest(nightly_config, upstream_artifacts)
    assert manifest == expected_manifest
def test_get_upstream_artifacts(nightly_config, expected):
    task = get_task(nightly_config)
    assert get_upstream_artifacts(task) == expected