def run(self, appVersion, productName, version, buildNumber, updateChannels, ftpServer, bouncerServer, enUSPlatforms, hashFunction, updateLine, **updateKwargs): data = self.generate_data(appVersion, productName, version, buildNumber, updateChannels, ftpServer, bouncerServer, enUSPlatforms, updateLine, **updateKwargs) name = get_release_blob_name(productName, version, buildNumber, self.suffix) api = Release(name=name, auth0_secrets=self.auth0_secrets, api_root=self.api_root) try: current_data, data_version = api.get_data() except HTTPError as e: if e.response.status_code == 404: log.warning("Release blob doesn't exist, using empty data...") current_data, data_version = {}, None else: raise data = recursive_update(current_data, data) api.update_release(product=productName, hashFunction=hashFunction, releaseData=json.dumps(data), schemaVersion=self.schemaVersion, data_version=data_version)
def run(self, appVersion, productName, version, buildNumber, updateChannels, ftpServer, bouncerServer, enUSPlatforms, hashFunction, updateLine, **updateKwargs): blob = self.generate_data(appVersion, productName, version, buildNumber, updateChannels, ftpServer, bouncerServer, enUSPlatforms, updateLine, **updateKwargs) name = get_release_blob_name(productName, version, buildNumber, self.suffix) if self.backend_version == 2: log.info("Using backend version 2...") url = self.api_root + "/v2/releases/" + name data = {"product": productName, "blob": {}} session = get_balrog_session(auth0_secrets=self.auth0_secrets) try: current_data = balrog_request(session, "get", url) if current_data: data["blob"] = current_data["blob"] data["old_data_versions"] = current_data["data_versions"] except HTTPError as e: if e.response.status_code != 404: raise data["blob"] = always_merger.merge(data["blob"], blob) data["blob"]["schema_version"] = self.schemaVersion data["blob"]["hashFunction"] = hashFunction data["blob"]["name"] = name balrog_request(session, "put", url, json=data) else: log.info("Using legacy backend version...") api = Release(name=name, auth0_secrets=self.auth0_secrets, api_root=self.api_root) try: current_data, data_version = api.get_data() except HTTPError as e: if e.response.status_code == 404: log.warning( "Release blob doesn't exist, using empty data...") current_data, data_version = {}, None else: raise blob = recursive_update(current_data, blob) api.update_release(product=productName, hashFunction=hashFunction, releaseData=json.dumps(blob), schemaVersion=self.schemaVersion, data_version=data_version)
parser = argparse.ArgumentParser() parser.add_argument("action", help="'generate', or 'publish'") parser.add_argument("--old", help="Old release") parser.add_argument("--to", help="New release") parser.add_argument("--client-id", help="M2M Client ID for auth") parser.add_argument("--client-secret", help="M2M Client secret for auth") parser.add_argument("--mar-dir", help="Location to put/find partial mars") parser.add_argument("--nightly", help="Treat this as a nightly partial", action="store_true") args = parser.parse_args() balrog_opts = balrog_api_opts(args.client_id, args.client_secret) name = f"{PRODUCT_NAME}-{args.to}" # get release data from Balrog target_release = Release(name=name, **balrog_opts) # if the old build is 'nightly', infer it from the nightly Balrog Rule if args.old == 'nightly': nightly_rule = Rule(NIGHTLY_RULE_ID, **balrog_opts) nightly_rule_data = nightly_rule.get_data()[0] print(f"nightly = {nightly_rule_data['mapping']}") from_release = Release(name=nightly_rule_data["mapping"], **balrog_opts) else: from_release = Release(name=f"{PRODUCT_NAME}-{args.old}", **balrog_opts) from_release_data = from_release.get_data()[0] target_release_data = target_release.get_data()[0] # traverse platforms and locales for partials to build partials = []
"Darwin_x86_64-gcc3": { "OS_BOUNCER": "mac" }, "WINNT_x86_64-msvc": { "OS_BOUNCER": "win64" }, "Linux_x86_64-gcc3": { "OS_BOUNCER": "linux-x86_64" }, "Darwin_aarch64-gcc3": { "alias": "Darwin_x86_64-gcc3" } } } print(json.dumps(release_data, indent=2)) api = Release(name=name, **balrog_opts) api.update_release(product=PRODUCT_NAME, hashFunction='sha512', releaseData=json.dumps(release_data), schemaVersion=9) elif args.action == 'build': mar_path = os.path.split(args.mar) [_, locale, platform, _, _] = mar_path[-1].rsplit('.', 4) print(f'Locale={locale}; Platform={platform}') api = SingleLocale(name=name, build_target=get_build_target_for_platform(platform), locale=locale, **balrog_opts) url = get_update_url(args.tag, PRODUCT_NAME, app_version, locale, platform)