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))
def test_get_task_server(nightly_config, scopes, expected, raises): task = get_task(nightly_config) task["scopes"] = scopes if raises: with pytest.raises(ValueError): get_task_server(task, nightly_config) else: assert expected == get_task_server(task, nightly_config)
def test_get_task_server(nightly_config, scopes, expected, raises): task = get_task(nightly_config) task['scopes'] = scopes if raises: with pytest.raises(ValueError): get_task_server(task, nightly_config) else: assert expected == get_task_server(task, nightly_config)
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
def test_submit_locale(config, nightly_config, nightly_manifest, mocker): auth0_secrets = None _, release = bscript.create_locale_submitter(nightly_manifest[0], '', auth0_secrets, config) def fake_submitter(**kwargs): assert kwargs == release task = get_task(nightly_config) m = mock.MagicMock() m.run = fake_submitter mocker.patch.object(bscript, "create_locale_submitter", return_value=(m, release)) bscript.submit_locale(task, config, auth0_secrets)
def main(config_path=None): config = setup_config(config_path) setup_logging(config['verbose']) task = get_task(config) action = get_task_action(task, config) validate_task_schema(config, task, action) server = get_task_server(task, config) balrog_auth, config = update_config(config, server) if action == 'submit-toplevel': submit_toplevel(task, config, balrog_auth) elif action == 'schedule': schedule(task, config, balrog_auth) else: submit_locale(task, config, balrog_auth)
def main(config_path=None): # TODO use scriptworker's sync_main(...) config = setup_config(config_path) setup_logging(config['verbose']) task = get_task(config) action = get_task_action(task, config) validate_task_schema(config, task, action) server = get_task_server(task, config) auth0_secrets, config = update_config(config, server) if action == 'submit-toplevel': submit_toplevel(task, config, auth0_secrets) elif action == 'schedule': schedule(task, config, auth0_secrets) else: submit_locale(task, config, auth0_secrets)
def main(config_path=None): config = setup_config(config_path) setup_logging(config['verbose']) task = get_task(config) action = get_task_action(task, config) validate_task_schema(config, task, action) server = get_task_server(task, config) balrog_auth, config = update_config(config, server) # 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 if action == 'submit-toplevel': submit_toplevel(task, config, balrog_auth) elif action == 'schedule': schedule(task, config, balrog_auth) else: submit_locale(task, config, balrog_auth)
def test_get_task_payload(nightly_config): upstream = get_task(nightly_config)['payload']['upstreamArtifacts'] assert upstream[0]['paths'][0] == 'public/manifest.json'
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
def test_get_task_payload(nightly_config): upstream = get_task(nightly_config)["payload"]["upstreamArtifacts"] assert upstream[0]["paths"][0] == "public/manifest.json"