Index: infra/bots/recipe_modules/vars/api.py |
diff --git a/infra/bots/recipe_modules/vars/api.py b/infra/bots/recipe_modules/vars/api.py |
index 945cf913fac44254c8ca2298b389f3f5d080b1e9..d36ab13a9da1aa0e19b2c22c2dad49fc65268c67 100644 |
--- a/infra/bots/recipe_modules/vars/api.py |
+++ b/infra/bots/recipe_modules/vars/api.py |
@@ -35,6 +35,7 @@ class SkiaVarsApi(recipe_api.RecipeApi): |
self.gclient_env = {} |
self.is_compile_bot = self.builder_name.startswith('Build-') |
self.no_buildbot = self.m.properties.get('nobuildbot', '') == 'True' |
+ self.skia_task_id = self.m.properties.get('skia_task_id', None) |
self.default_env['CHROME_HEADLESS'] = '1' |
# The 'depot_tools' directory comes from recipe DEPS and isn't provided by |
@@ -113,12 +114,16 @@ class SkiaVarsApi(recipe_api.RecipeApi): |
self.issue = None |
self.patchset = None |
if self.no_buildbot: |
- self.is_trybot = ( |
- self.m.properties.get('issue', '') and |
- self.m.properties.get('patchset', '')) |
- if self.is_trybot: |
+ if (self.m.properties.get('issue', '') and |
+ self.m.properties.get('patchset', '')): |
+ self.is_trybot = True |
self.issue = self.m.properties['issue'] |
self.patchset = self.m.properties['patchset'] |
+ elif (self.m.properties.get('event.change.number', '') and |
+ self.m.properties.get('event.patchSet.ref', '')): |
+ self.is_trybot = True |
+ self.issue = self.m.properties['event.change.number'] |
+ self.patchset = self.m.properties['event.patchSet.ref'].split('/')[-1] |
else: |
self.is_trybot = self.builder_cfg['is_trybot'] |
if self.is_trybot: |
@@ -133,6 +138,8 @@ class SkiaVarsApi(recipe_api.RecipeApi): |
self.swarming_out_dir, 'dm') |
self.perf_data_dir = self.m.path.join(self.swarming_out_dir, |
'perfdata', self.builder_name, 'data') |
+ self._swarming_bot_id = None |
+ self._swarming_task_id = None |
@property |
def upload_dm_results(self): |
@@ -171,3 +178,26 @@ class SkiaVarsApi(recipe_api.RecipeApi): |
upload_perf_results = False |
break |
return upload_perf_results |
+ |
+ @property |
+ def swarming_bot_id(self): |
+ if not self._swarming_bot_id: |
+ self._swarming_bot_id = self.m.python.inline( |
+ name='get swarming bot id', |
+ program='''import os |
+print os.environ.get('SWARMING_BOT_ID', '') |
+''', |
+ stdout=self.m.raw_io.output()).stdout.rstrip() |
+ return self._swarming_bot_id |
+ |
+ @property |
+ def swarming_task_id(self): |
+ if not self._swarming_task_id: |
+ self._swarming_task_id = self.m.python.inline( |
+ name='get swarming task id', |
+ program='''import os |
+print os.environ.get('SWARMING_TASK_ID', '') |
+''', |
+ stdout=self.m.raw_io.output()).stdout.rstrip() |
+ return self._swarming_task_id |
+ |