From 390203392e10f41a207005b17a965d79ff29e75d Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Fri, 28 Aug 2015 11:59:28 +0200 Subject: [PATCH] Pass update_number through Jenkins for treeherder reporting (#627) --- config/production/pulse.json | 6 ++++++ config/staging/pulse.json | 6 ++++++ .../jobs/mozilla-aurora_update/config.xml | 7 ++++++- .../jobs/mozilla-central_update/config.xml | 7 ++++++- .../jobs/scripts/workspace/runtests.py | 14 ++++++++++--- .../scripts/workspace/runtests_release.py | 14 ++++++++++--- .../jobs/scripts/workspace/treeherder.py | 21 +++++++++++++++---- 7 files changed, 63 insertions(+), 12 deletions(-) diff --git a/config/production/pulse.json b/config/production/pulse.json index 324cd5ea..adfd699a 100644 --- a/config/production/pulse.json +++ b/config/production/pulse.json @@ -58,6 +58,9 @@ }, "TARGET_BUILD_ID": { "key": "to_buildid" + }, + "UPDATE_NUMBER": { + "key": "update_number" } } } @@ -121,6 +124,9 @@ }, "TARGET_BUILD_ID": { "key": "to_buildid" + }, + "UPDATE_NUMBER": { + "key": "update_number" } } } diff --git a/config/staging/pulse.json b/config/staging/pulse.json index 0009a9ca..8f88d692 100644 --- a/config/staging/pulse.json +++ b/config/staging/pulse.json @@ -58,6 +58,9 @@ }, "TARGET_BUILD_ID": { "key": "to_buildid" + }, + "UPDATE_NUMBER": { + "key": "update_number" } } } @@ -120,6 +123,9 @@ }, "TARGET_BUILD_ID": { "key": "to_buildid" + }, + "UPDATE_NUMBER": { + "key": "update_number" } } } diff --git a/jenkins-master/jobs/mozilla-aurora_update/config.xml b/jenkins-master/jobs/mozilla-aurora_update/config.xml index 3f6e317c..00d640ef 100644 --- a/jenkins-master/jobs/mozilla-aurora_update/config.xml +++ b/jenkins-master/jobs/mozilla-aurora_update/config.xml @@ -79,6 +79,11 @@ The expected build id of Firefox after the update. None + + UPDATE_NUMBER + The number of the partial update: today - N days + None + @@ -135,7 +140,7 @@ NSPR_LOG_FILE=http.log - python runtests.py --type=update --branch=mozilla-aurora --platform=$PLATFORM --build-type=$BUILD_TYPE --build-id=$BUILD_ID --build-locale=$LOCALE --build-revision=$REVISION --update-channel=$CHANNEL --update-target-build-id=$TARGET_BUILD_ID + python runtests.py --type=update --branch=mozilla-aurora --platform=$PLATFORM --build-type=$BUILD_TYPE --build-id=$BUILD_ID --build-locale=$LOCALE --build-revision=$REVISION --update-channel=$CHANNEL --update-target-build-id=$TARGET_BUILD_ID --update-number=$UPDATE_NUMBER false diff --git a/jenkins-master/jobs/mozilla-central_update/config.xml b/jenkins-master/jobs/mozilla-central_update/config.xml index a6ad8d3c..bca2eec3 100644 --- a/jenkins-master/jobs/mozilla-central_update/config.xml +++ b/jenkins-master/jobs/mozilla-central_update/config.xml @@ -79,6 +79,11 @@ The expected build id of Firefox after the update. None + + UPDATE_NUMBER + The number of the partial update: today - N days + None + @@ -135,7 +140,7 @@ NSPR_LOG_FILE=http.log - python runtests.py --type=update --branch=mozilla-central --platform=$PLATFORM --build-type=$BUILD_TYPE --build-id=$BUILD_ID --build-locale=$LOCALE --build-revision=$REVISION --update-channel=$CHANNEL --update-target-build-id=$TARGET_BUILD_ID + python runtests.py --type=update --branch=mozilla-central --platform=$PLATFORM --build-type=$BUILD_TYPE --build-id=$BUILD_ID --build-locale=$LOCALE --build-revision=$REVISION --update-channel=$CHANNEL --update-target-build-id=$TARGET_BUILD_ID --update-number=$UPDATE_NUMBER false diff --git a/jenkins-master/jobs/scripts/workspace/runtests.py b/jenkins-master/jobs/scripts/workspace/runtests.py index d22fb697..03d30f7c 100755 --- a/jenkins-master/jobs/scripts/workspace/runtests.py +++ b/jenkins-master/jobs/scripts/workspace/runtests.py @@ -95,10 +95,11 @@ def run_tests(self, options, args): if os.environ.get('TREEHERDER_URL'): # Setup job for treeherder and post 'running' status - job = FirefoxUITestJob(product_name=version_info['application_name'], + job = FirefoxUITestJob(job_type=options.type, + product_name=version_info['application_name'], locale=options.build_locale, - group_name='Firefox UI Test - %s' % options.type, - group_symbol='F%s' % options.type[0]) + update_number=options.update_number + ) if os.environ.get('BUILD_URL'): job.add_details(title='CI Build', @@ -230,6 +231,9 @@ def main(): update_options.add_option('--update-channel', dest='update_channel', help='The update channel to use for the update test') + update_options.add_option('--update-number', + dest='update_number', + help='The number of the partial update: today - N days.') update_options.add_option('--update-target-build-id', dest='update_target_build_id', help='The expected BUILDID of the updated build') @@ -240,6 +244,10 @@ def main(): (options, args) = parser.parse_args() + # Fix defaults as passed in by Jenkins + if options.update_number == 'None': + options.update_number = None + try: path = os.path.abspath(os.path.join(here, 'venv')) runner = Runner(venv_path=path) diff --git a/jenkins-master/jobs/scripts/workspace/runtests_release.py b/jenkins-master/jobs/scripts/workspace/runtests_release.py index ceda2b73..cafd3e45 100755 --- a/jenkins-master/jobs/scripts/workspace/runtests_release.py +++ b/jenkins-master/jobs/scripts/workspace/runtests_release.py @@ -97,10 +97,11 @@ def run_tests(self, options, args): if os.environ.get('TREEHERDER_URL'): # Setup job for treeherder and post 'running' status - job = FirefoxUITestJob(product_name=version_info['application_name'], + job = FirefoxUITestJob(job_type=options.type, + product_name=version_info['application_name'], locale=options.build_locale, - group_name='Firefox UI Test - %s' % options.type, - group_symbol='F%s' % options.type[0]) + update_number=options.update_number + ) if os.environ.get('BUILD_URL'): job.add_details(title='CI Build', @@ -226,6 +227,9 @@ def main(): update_options.add_option('--update-channel', dest='update_channel', help='The update channel to use for the update test') + update_options.add_option('--update-number', + dest='update_number', + help='The number of the partial update: today - N days.') update_options.add_option('--update-target-build-id', dest='update_target_build_id', help='The expected BUILDID of the updated build') @@ -236,6 +240,10 @@ def main(): (options, args) = parser.parse_args() + # Fix defaults as passed in by Jenkins + if options.update_number == 'None': + options.update_number = None + try: path = os.path.abspath(os.path.join(here, 'venv')) runner = Runner(venv_path=path) diff --git a/jenkins-master/jobs/scripts/workspace/treeherder.py b/jenkins-master/jobs/scripts/workspace/treeherder.py index 6e6564f4..2fe57d29 100644 --- a/jenkins-master/jobs/scripts/workspace/treeherder.py +++ b/jenkins-master/jobs/scripts/workspace/treeherder.py @@ -20,7 +20,7 @@ class FirefoxUITestJob(TreeherderJob): - def __init__(self, product_name, locale, group_name, group_symbol): + def __init__(self, job_type, product_name, locale, update_number=None): TreeherderJob.__init__(self, data={}) self._details = [] @@ -41,13 +41,26 @@ def __init__(self, product_name, locale, group_name, group_symbol): # TODO debug or others? self.add_option_collection({'opt': True}) + group_name = 'Firefox UI Test - {type}'.format(type=job_type) + group_symbol = 'F{type_id}'.format(type_id=job_type[0]) + + # Bug 1174973 - for now we need unique job names even in different groups + job_name = '{group} ({locale}{update_number})'.format( + group=group_name, + locale=locale, + update_number='-{}'.format(update_number) if update_number else '' + ) + job_symbol = '{locale}{update_number}'.format( + locale=locale, + update_number='-{}'.format(update_number) if update_number else '' + ) + # TODO: Add e10s group later self.add_group_name(group_name) self.add_group_symbol(group_symbol) - # Bug 1174973 - for now we need unique job names even in different groups - self.add_job_name("%s (%s)" % (group_name, locale)) - self.add_job_symbol(locale) + self.add_job_name(job_name) + self.add_job_symbol(job_symbol) self.add_start_timestamp(int(time.time()))