def get_updated_buildhub_artifact(path, installer_artifact, installer_path, context, locale, manifest=None, artifact_map=None): """ Read the file into a dict, alter the fields below, and return the updated dict buildhub.json fields that should be changed: download.size, download.date, download.url """ contents = utils.load_json(path) url_prefix = context.config["bucket_config"][context.bucket]["url_prefix"] if artifact_map: task_id = get_taskId_from_full_path(installer_path) cfg = utils.extract_file_config_from_artifact_map( artifact_map, installer_artifact, task_id, locale) path = urllib.parse.quote(cfg["destinations"][0]) else: dest = manifest["mapping"][locale][installer_artifact]["destinations"][ 0] path = urllib.parse.quote( urllib.parse.urljoin(manifest["s3_bucket_path"], dest)) url = urllib.parse.urljoin(url_prefix, path) # Update fields contents["download"]["size"] = utils.get_size(installer_path) contents["download"]["date"] = str(arrow.utcnow()) contents["download"]["url"] = url return contents
def get_fake_valid_config(): config = { 'release_schema_file': 'beetmoverscript/data/release_beetmover_task_schema.json', 'schema_file': 'beetmoverscript/data/beetmover_task_schema.json', 'maven_schema_file': 'beetmoverscript/data/maven_beetmover_task_schema.json', } config.update(load_json(path="beetmoverscript/test/fake_config.json")) return config
def setup_config(config_path): if config_path is None: if len(sys.argv) != 2: usage() config_path = sys.argv[1] context = Context() context.config = {} context.config.update(load_json(path=config_path)) return context
def get_fake_valid_config(): config = { "release_schema_file": "src/beetmoverscript/data/release_beetmover_task_schema.json", "schema_file": "src/beetmoverscript/data/beetmover_task_schema.json", "maven_schema_file": "src/beetmoverscript/data/maven_beetmover_task_schema.json", } config.update(load_json(path="tests/fake_config.json")) return config
def get_updated_buildhub_artifact(path, installer_path, context, manifest, locale): """ Read the file into a dict, alter the fields below, and return the updated dict buildhub.json fields that should be changed: download.size, download.date, download.url """ contents = utils.load_json(path) installer_name = os.path.basename(installer_path) dest = manifest['mapping'][locale][installer_name]['destinations'] url_prefix = context.config["bucket_config"][context.bucket]["url_prefix"] # assume url_prefix is ASCII safe url = urllib.parse.quote(urllib.parse.urljoin(manifest["s3_bucket_path"], dest[0])) # Update fields contents['download']['size'] = utils.get_size(installer_path) contents['download']['date'] = str(arrow.utcnow()) contents['download']['url'] = urllib.parse.urljoin(url_prefix, url) return contents
def get_release_props(context, platform_mapping=STAGE_PLATFORM_MAP): """determined via parsing the Nightly build job's balrog_props.json and expanded the properties with props beetmover knows about.""" payload_properties = context.task.get('payload', {}).get('releaseProperties', None) initial_release_props_file = None if payload_properties: props = payload_properties log.debug( "Loading release_props from task's payload: {}".format(props)) else: initial_release_props_file = get_initial_release_props_file(context) props = utils.load_json(initial_release_props_file)['properties'] log.warn( 'Deprecated behavior! This will be gone after Firefox 59 reaches release. Loading release_props from "{}": {}' .format(initial_release_props_file, props)) final_props = update_props(context, props, platform_mapping) return (final_props, initial_release_props_file)
def get_fake_valid_task(): return load_json(path="beetmoverscript/test/test_work_dir/task.json")
def get_fake_valid_config(): return load_json(path="beetmoverscript/test/fake_config.json")
def get_fake_balrog_props(): return load_json(path="beetmoverscript/test/test_work_dir/cot/eSzfNqMZT_mSiQQXu8hyqg/public/build/balrog_props.json")
def get_fake_valid_task(taskjson="task.json"): return load_json(path="tests/test_work_dir/{}".format(taskjson))
def get_fake_valid_task(taskjson='task.json'): return load_json( path="beetmoverscript/test/test_work_dir/{}".format(taskjson))
def get_fake_balrog_manifest(): return load_json(path="beetmoverscript/test/fake_balrog_manifest.json")
def get_fake_balrog_props(): return load_json(path="beetmoverscript/test/fake_balrog_props.json")
def get_fake_balrog_props(): return load_json(path=get_fake_balrog_props_path())