1
0
Fork 0

Upload Fenix Nightly to Nimbledroid #4222 (#4253)

master
kglazko 2019-08-02 11:57:46 -07:00 committed by GitHub
parent 83ceec6289
commit 46b2d6f937
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 3 deletions

View File

@ -158,6 +158,7 @@ def nightly_to_production_app(is_staging, version_name):
build_tasks = {}
signing_tasks = {}
push_tasks = {}
other_tasks = {}
build_task_id = taskcluster.slugId()
build_tasks[build_task_id] = BUILDER.craft_assemble_release_task(architectures, build_type, is_staging, version_name)
@ -180,7 +181,12 @@ def nightly_to_production_app(is_staging, version_name):
is_staging=is_staging,
)
return (build_tasks, signing_tasks, push_tasks)
nimbledroid_task_id = taskcluster.slugId()
other_tasks[nimbledroid_task_id] = BUILDER.craft_upload_apk_nimbledroid_task(
build_task_id
)
return (build_tasks, signing_tasks, push_tasks, other_tasks)
if __name__ == "__main__":

View File

@ -162,7 +162,6 @@ class TaskBuilder(object):
'tier': 1,
},
)
def craft_ui_tests_task(self):
artifacts = {
@ -203,7 +202,27 @@ class TaskBuilder(object):
artifacts=artifacts,
env_vars=env_vars,
)
def craft_upload_apk_nimbledroid_task(self, assemble_task_id):
# For GeckoView, upload nightly (it has release config) by default, all Release builds have WV
return self._craft_build_ish_task(
name="Upload Release APK to Nimbledroid",
description='Upload APKs to Nimbledroid for performance measurement and tracking.',
command=' && '.join([
'curl --location "{}/{}/artifacts/public/target.apk" > target.apk'.format(_DEFAULT_TASK_URL, assemble_task_id),
'python automation/taskcluster/upload_apk_nimbledroid.py',
]),
treeherder={
'jobKind': 'test',
'machine': {
'platform': 'android-all',
},
'symbol': 'compare-locale',
'tier': 2,
},
scopes=["secrets:get:project/mobile/fenix/nimbledroid"],
dependencies=[assemble_task_id],
)
def craft_detekt_task(self):
return self._craft_clean_gradle_task(

View File

@ -0,0 +1,46 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
This script talks to the taskcluster secrets service to obtain the
Nimbledroid account key and upload Klar and Focus apk to Nimbledroid for perf analysis.
"""
import taskcluster
import requests
import json
import urllib2
import os
url = "https://nimbledroid.com/api/v2/apks"
def uploadApk(apk,key):
headers = {"Accept":"*/*"}
payload = {'auto_scenarios':'false'}
response = requests.post(url, auth=(key, ''), headers=headers, files=apk, data=payload)
if response.status_code != 201:
print('Status:', response.status_code, 'Headers:', response.headers, 'Error Response:',response.json())
exit(1)
# Print Response Details
print 'Response Status Code:', response.status_code
print ''
print('Reponse Payload:')
print json.dumps(response.json(), indent=4)
def uploadNightlyFenixApk(key):
apk_url = 'https://index.taskcluster.net/v1/task/project.mobile.fenix.v2.nightly.latest/artifacts/public/build/arm/target.apk'
apk_data = urllib2.urlopen(apk_url).read()
with open('./fenix_example_nd.apk', 'wb') as f:
f.write(apk_data)
uploadApk({'apk' : open('fenix_example_nd.apk')},key)
# Get JSON data from taskcluster secrets service
secrets = taskcluster.Secrets({'baseUrl': 'http://taskcluster/secrets/v1'})
data = secrets.get('project/mobile/fenix/nimbledroid')
# upload the nightly build to Nimbledroid
uploadNightlyFenixApk(data['secret']['api_key'])