async def async_main(context): android_product = task.extract_android_product_from_scopes(context) product_config = _get_product_config(context, android_product) publish_config = get_publish_config(product_config, context.task['payload'], android_product) contact_server = not bool(context.config.get('do_not_contact_server')) logging.getLogger('oauth2client').setLevel(logging.WARNING) _log_warning_forewords(contact_server, publish_config['dry_run'], publish_config['target_store']) log.info('Verifying upstream artifacts...') artifacts_per_task_id, failed_artifacts_per_task_id = artifacts.get_upstream_artifacts_full_paths_per_task_id(context) all_apks_paths = [ artifact for artifacts_list in artifacts_per_task_id.values() for artifact in artifacts_list if artifact.endswith('.apk') ] if not publish_config.get('skip_check_signature', True): log.info('Verifying APKs\' signatures...') for apk_path in all_apks_paths: jarsigner.verify(context, publish_config, apk_path) manifest.verify(product_config, apk_path) else: log.info('This product is configured with "skip_check_signature", so the signing of the ' 'APK will not be verified.') log.info('Delegating publication to mozapkpublisher...') with contextlib.ExitStack() as stack: files = [stack.enter_context(open(apk_file_name)) for apk_file_name in all_apks_paths] publish.publish(product_config, publish_config, files, contact_server) log.info('Done!')
def test_verify(monkeypatch, does_apk_have_expected_digest, raises): monkeypatch.setattr(manifest, "_does_apk_have_expected_digest", lambda _, __: does_apk_have_expected_digest) product_config = {"digest_algorithm": "SHA1"} if raises: with pytest.raises(SignatureError): manifest.verify(product_config, "/some/apk_path") else: manifest.verify(product_config, "/some/apk_path")
def test_verify(monkeypatch, does_apk_have_expected_digest, raises): monkeypatch.setattr(manifest, '_does_apk_have_expected_digest', lambda _, __: does_apk_have_expected_digest) product_config = {'digest_algorithm': 'SHA-1'} if raises: with pytest.raises(SignatureError): manifest.verify(product_config, '/some/apk_path') else: manifest.verify(product_config, '/some/apk_path')
async def async_main(context): android_product = task.extract_android_product_from_scopes(context) product_config = _get_product_config(context, android_product) contact_google_play = not bool( context.config.get('do_not_contact_google_play')) logging.getLogger('oauth2client').setLevel(logging.WARNING) _log_warning_forewords(contact_google_play, context.task['payload']) log.info('Verifying upstream artifacts...') artifacts_per_task_id, failed_artifacts_per_task_id = artifacts.get_upstream_artifacts_full_paths_per_task_id( context) all_apks_paths = [ artifact for artifacts_list in artifacts_per_task_id.values() for artifact in artifacts_list if artifact.endswith('.apk') ] log.info('Verifying APKs\' signatures...') for apk_path in all_apks_paths: jarsigner.verify(context, apk_path) manifest.verify(product_config, apk_path) if product_config['update_google_play_strings']: log.info('Finding whether Google Play strings can be updated...') strings_path = googleplay.get_google_play_strings_path( artifacts_per_task_id, failed_artifacts_per_task_id) else: log.warning( 'This product does not upload strings automatically. Skipping Google Play strings search.' ) strings_path = None log.info('Delegating publication to mozapkpublisher...') with contextlib.ExitStack() as stack: files = [ stack.enter_context(open(apk_file_name)) for apk_file_name in all_apks_paths ] strings_file = stack.enter_context( open(strings_path)) if strings_path is not None else None googleplay.publish_to_googleplay(context.task['payload'], product_config, files, contact_google_play, strings_file) log.info('Done!')
def test_verify(monkeypatch, does_apk_have_expected_digest, raises): monkeypatch.setattr(manifest, '_does_apk_have_expected_digest', lambda _, __: does_apk_have_expected_digest) context = MagicMock() context.config = { 'taskcluster_scope_prefixes': ['project:releng:googleplay:'] } context.task = { 'scopes': ['project:releng:googleplay:aurora'], } if raises: with pytest.raises(SignatureError): manifest.verify(context, '/some/apk_path') else: manifest.verify(context, '/some/apk_path')
async def async_main(context): logging.getLogger('oauth2client').setLevel(logging.WARNING) _log_warning_forewords(context) log.info('Verifying upstream artifacts...') artifacts_per_task_id, failed_artifacts_per_task_id = artifacts.get_upstream_artifacts_full_paths_per_task_id( context) all_apks_paths = [ artifact for artifacts_list in artifacts_per_task_id.values() for artifact in artifacts_list if artifact.endswith('.apk') ] log.info('Verifying APKs\' signatures...') for apk_path in all_apks_paths: jarsigner.verify(context, apk_path) manifest.verify(context, apk_path) if task.extract_android_product_from_scopes(context) in [ 'focus', 'reference-browser' ]: log.warning( 'This product does not upload strings automatically. Skipping Google Play strings search.' ) google_play_strings_path = None else: log.info('Finding whether Google Play strings can be updated...') google_play_strings_path = googleplay.get_google_play_strings_path( artifacts_per_task_id, failed_artifacts_per_task_id) log.info('Delegating publication to mozapkpublisher...') googleplay.publish_to_googleplay( context, all_apks_paths, google_play_strings_path, ) log.info('Done!')