Skip to content
This repository has been archived by the owner on May 15, 2018. It is now read-only.

Commit

Permalink
Pass update_number through Jenkins for treeherder reporting (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
whimboo committed Aug 28, 2015
1 parent 75ce300 commit 3902033
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 12 deletions.
6 changes: 6 additions & 0 deletions config/production/pulse.json
Expand Up @@ -58,6 +58,9 @@
},
"TARGET_BUILD_ID": {
"key": "to_buildid"
},
"UPDATE_NUMBER": {
"key": "update_number"
}
}
}
Expand Down Expand Up @@ -121,6 +124,9 @@
},
"TARGET_BUILD_ID": {
"key": "to_buildid"
},
"UPDATE_NUMBER": {
"key": "update_number"
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions config/staging/pulse.json
Expand Up @@ -58,6 +58,9 @@
},
"TARGET_BUILD_ID": {
"key": "to_buildid"
},
"UPDATE_NUMBER": {
"key": "update_number"
}
}
}
Expand Down Expand Up @@ -120,6 +123,9 @@
},
"TARGET_BUILD_ID": {
"key": "to_buildid"
},
"UPDATE_NUMBER": {
"key": "update_number"
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion jenkins-master/jobs/mozilla-aurora_update/config.xml
Expand Up @@ -79,6 +79,11 @@
<description>The expected build id of Firefox after the update.</description>
<defaultValue>None</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>UPDATE_NUMBER</name>
<description>The number of the partial update: today - N days</description>
<defaultValue>None</defaultValue>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
<EnvInjectJobProperty plugin="envinject@1.88">
Expand Down Expand Up @@ -135,7 +140,7 @@ NSPR_LOG_FILE=http.log</propertiesContent>
<selector class="hudson.plugins.copyartifact.StatusBuildSelector"/>
</hudson.plugins.copyartifact.CopyArtifact>
<hudson.plugins.xshell.XShellBuilder plugin="xshell@0.9-SNAPSHOT">
<commandLine>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</commandLine>
<commandLine>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</commandLine>
<executeFromWorkingDir>false</executeFromWorkingDir>
</hudson.plugins.xshell.XShellBuilder>
</builders>
Expand Down
7 changes: 6 additions & 1 deletion jenkins-master/jobs/mozilla-central_update/config.xml
Expand Up @@ -79,6 +79,11 @@
<description>The expected build id of Firefox after the update.</description>
<defaultValue>None</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>UPDATE_NUMBER</name>
<description>The number of the partial update: today - N days</description>
<defaultValue>None</defaultValue>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
<EnvInjectJobProperty plugin="envinject@1.88">
Expand Down Expand Up @@ -135,7 +140,7 @@ NSPR_LOG_FILE=http.log</propertiesContent>
<selector class="hudson.plugins.copyartifact.StatusBuildSelector"/>
</hudson.plugins.copyartifact.CopyArtifact>
<hudson.plugins.xshell.XShellBuilder plugin="xshell@0.9-SNAPSHOT">
<commandLine>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</commandLine>
<commandLine>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</commandLine>
<executeFromWorkingDir>false</executeFromWorkingDir>
</hudson.plugins.xshell.XShellBuilder>
</builders>
Expand Down
14 changes: 11 additions & 3 deletions jenkins-master/jobs/scripts/workspace/runtests.py
Expand Up @@ -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',
Expand Down Expand Up @@ -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')
Expand All @@ -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)
Expand Down
14 changes: 11 additions & 3 deletions jenkins-master/jobs/scripts/workspace/runtests_release.py
Expand Up @@ -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',
Expand Down Expand Up @@ -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')
Expand All @@ -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)
Expand Down
21 changes: 17 additions & 4 deletions jenkins-master/jobs/scripts/workspace/treeherder.py
Expand Up @@ -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 = []
Expand All @@ -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()))

Expand Down

0 comments on commit 3902033

Please sign in to comment.