mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1551738: Add a helper to extract the task name from the final task; r=Callek
Differential Revision: https://phabricator.services.mozilla.com/D31160 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
cb6a48a553
commit
8c5f40229c
@ -46,6 +46,15 @@ class Task(object):
|
||||
def __attrs_post_init__(self):
|
||||
self.attributes['kind'] = self.kind
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self.label.startswith(self.kind + "-"):
|
||||
return self.label[len(self.kind)+1:]
|
||||
elif self.label.startswith("build-docker-image-"):
|
||||
return self.label[len("build-docker-image-"):]
|
||||
else:
|
||||
raise AttributeError("Task {} does not have a name.".format(self.label))
|
||||
|
||||
def to_json(self):
|
||||
rv = {
|
||||
'kind': self.kind,
|
||||
|
@ -187,8 +187,7 @@ def setup_name(config, jobs):
|
||||
dep = job['primary-dependency']
|
||||
# Set the name to the same as the dep task, without kind name.
|
||||
# Label will get set automatically with this kinds name.
|
||||
job['name'] = job.get('name',
|
||||
dep.task['metadata']['name'][len(dep.kind) + 1:])
|
||||
job['name'] = job.get('name', dep.name)
|
||||
yield job
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user