Bug 1130696 - Update pull gaia script to use correct version based on gaia.json in gecko r=garndt

This commit is contained in:
jlal@mozilla.com 2015-02-09 21:54:55 -08:00
parent 8670996907
commit 75ee79ed94
5 changed files with 58 additions and 12 deletions

View File

@ -2,11 +2,13 @@ FROM quay.io/mozilla/base-test:0.0.1
MAINTAINER Jonas Finnemann Jensen <jopsen@gmail.com>
# Add utilities and configuration
ADD b2g-desktop-config.py /home/worker/b2g-desktop-config.py
ADD dot-config /home/worker/.config
ADD dot-pulse /home/worker/.pulse
ADD bin /home/worker/bin
ADD mozharness_configs /home/worker/mozharness_configs
COPY b2g-desktop-config.py /home/worker/b2g-desktop-config.py
COPY dot-config /home/worker/.config
COPY dot-pulse /home/worker/.pulse
COPY bin /home/worker/bin
COPY mozharness_configs /home/worker/mozharness_configs
COPY buildprops.json /home/worker/buildprops.json
# Run test setup script
RUN pip install virtualenv;

View File

@ -1 +1 @@
0.0.10
0.0.12

View File

@ -1,3 +1,13 @@
#!/bin/bash -vex
gaia_dir=/home/worker/gaia
tc-vcs checkout $gaia_dir https://hg.mozilla.org/integration/gaia-central/
test $GAIA_BASE_REPOSITORY # ex: https://github.com/mozilla-b2g/gaia
test $GAIA_HEAD_REPOSITORY # ex: https://github.com/mozilla-b2g/gaia
test $GAIA_REF # ex: master
test $GAIA_REV # ex: master
tc-vcs \
checkout \
/home/worker/gaia \
$GAIA_BASE_REPOSITORY \
$GAIA_HEAD_REPOSITORY \
$GAIA_REV \
$GAIA_REF \

View File

@ -28,6 +28,7 @@ from taskcluster_graph.templates import Templates
import taskcluster_graph.build_task
ROOT = os.path.dirname(os.path.realpath(__file__))
GECKO = os.path.realpath(os.path.join(ROOT, '..', '..'))
DOCKER_ROOT = os.path.join(ROOT, '..', 'docker')
# XXX: If/when we have the taskcluster queue use construct url instead
@ -92,6 +93,35 @@ def get_task(task_id):
return json.load(urllib2.urlopen("https://queue.taskcluster.net/v1/task/" + task_id))
def gaia_info():
'''
Fetch details from in tree gaia.json (which links this version of
gecko->gaia) and construct the usual base/head/ref/rev pairing...
'''
gaia = json.load(open(os.path.join(GECKO, 'b2g', 'config', 'gaia.json')))
if gaia['git'] is None or \
gaia['git']['remote'] == '' or \
gaia['git']['git_revision'] == '' or \
gaia['git']['branch'] == '':
# Just use the hg params...
return {
'gaia_base_repository': 'https://hg.mozilla.org/{}'.format(gaia['repo_path']),
'gaia_head_repository': 'https://hg.mozilla.org/{}'.format(gaia['repo_path']),
'gaia_ref': gaia['revision'],
'gaia_rev': gaia['revision']
}
else:
# Use git
return {
'gaia_base_repository': gaia['git']['remote'],
'gaia_head_repository': gaia['git']['remote'],
'gaia_rev': gaia['git']['git_revision'],
'gaia_ref': gaia['git']['branch'],
}
@CommandProvider
class DecisionTask(object):
@Command('taskcluster-decision', category="ci",
@ -117,7 +147,7 @@ class DecisionTask(object):
def run_task(self, **params):
templates = Templates(ROOT)
# Template parameters used when expanding the graph
parameters = {
parameters = dict(gaia_info().items() + {
'source': 'http://todo.com/soon',
'project': params['project'],
'comment': params['comment'],
@ -128,7 +158,7 @@ class DecisionTask(object):
'as_slugid': SlugidJar(),
'from_now': json_time_from_now,
'now': datetime.datetime.now().isoformat()
}
}.items())
task = templates.load(params['task'], parameters)
print(json.dumps(task, indent=4))
@ -187,7 +217,7 @@ class Graph(object):
job_graph = parse_commit(message, jobs)
# Template parameters used when expanding the graph
parameters = {
parameters = dict(gaia_info().items() + {
'docker_image': docker_image,
'base_repository': params['base_repository'] or \
params['head_repository'],
@ -200,7 +230,7 @@ class Graph(object):
'mozharness_repository': params['mozharness_repository'],
'mozharness_rev': params['mozharness_rev'],
'revision_hash': params['revision_hash']
}
}.items())
treeherder_route = '{}.{}.{}'.format(
TREEHERDER_ROUTE_PREFIX,

View File

@ -20,6 +20,10 @@ task:
image: '{{#docker_image}}tester{{/docker_image}}'
maxRunTime: 3600
env:
GAIA_HEAD_REPOSITORY: '{{{gaia_head_repository}}}'
GAIA_BASE_REPOSITORY: '{{{gaia_base_repository}}}'
GAIA_REF: '{{{gaia_ref}}}'
GAIA_REV: '{{{gaia_rev}}}'
MOZHARNESS_REPOSITORY: '{{mozharness_repository}}'
MOZHARNESS_REV: '{{mozharness_rev}}'