Bug 1651538 - Relabel docker images with the prefix "docker-image" instead of "build-docker-image". r=tomprince

Differential Revision: https://phabricator.services.mozilla.com/D82807
This commit is contained in:
Mike Hommey 2020-10-09 00:07:56 +00:00
Родитель 22dbe9a21d
Коммит 93b282a460
8 изменённых файлов: 10 добавлений и 15 удалений

Просмотреть файл

@ -192,7 +192,7 @@ Tasks of the ``docker-image`` kind build the Docker images in which other
Docker tasks run.
The tasks to generate each docker image have predictable labels:
``build-docker-image-<name>``.
``docker-image-<name>``.
Docker images are built from subdirectories of ``taskcluster/docker``, using
``docker build``. There is currently no capability for one Docker image to

Просмотреть файл

@ -25,7 +25,7 @@ from . import GECKO
def load_image_by_name(image_name, tag=None):
params = {'level': six.ensure_text(os.environ.get('MOZ_SCM_LEVEL', '3'))}
tasks = load_tasks_for_kind(params, 'docker-image')
task = tasks['build-docker-image-{}'.format(image_name)]
task = tasks['docker-image-{}'.format(image_name)]
task_id = IndexSearch().should_replace_task(
task, {}, task.optimization.get('index-search', []))

Просмотреть файл

@ -68,7 +68,7 @@ def derive_misc_task(
# this is why all docker image tasks are included in the target task graph: we
# need to find them in label_to_taskid, even if nothing else required them
image_taskid = label_to_taskid["build-docker-image-" + image]
image_taskid = label_to_taskid["docker-image-" + image]
provisioner_id, worker_type = get_worker_type(
graph_config, "misc", parameters["level"], parameters.release_level()

Просмотреть файл

@ -18,7 +18,7 @@ class Task(object):
- task: the task definition (JSON-able dictionary)
- optimization: optimization to apply to the task (see taskgraph.optimize)
- dependencies: tasks this one depends on, in the form {name: label}, for example
{'build': 'build-linux64/opt', 'docker-image': 'build-docker-image-desktop-test'}
{'build': 'build-linux64/opt', 'docker-image': 'docker-image-desktop-test'}
- soft_dependencies: tasks this one may depend on if they are available post
optimisation. They are set as a list of tasks label.
- if_dependencies: only run this task if at least one of these dependencies
@ -54,8 +54,6 @@ class Task(object):
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))

Просмотреть файл

@ -82,7 +82,7 @@ def test_make_index_tasks(make_taskgraph, graph_config):
},
}
task = Task(kind='test', label='a', attributes={}, task=task_def)
docker_task = Task(kind='docker-image', label='build-docker-image-index-task',
docker_task = Task(kind='docker-image', label='docker-image-index-task',
attributes={}, task={})
taskgraph, label_to_taskid = make_taskgraph({
task.label: task,

Просмотреть файл

@ -14,10 +14,7 @@ transforms = TransformSequence()
def order_tasks(config, tasks):
"""Iterate image tasks in an order where parent tasks come first."""
if config.kind == 'docker-image':
kind_prefix = 'build-docker-image-'
else:
kind_prefix = config.kind + '-'
kind_prefix = config.kind + '-'
pending = deque(tasks)
task_labels = {task['label'] for task in pending}

Просмотреть файл

@ -138,7 +138,7 @@ def fill_template(config, tasks):
# include some information that is useful in reconstructing this task
# from JSON
taskdesc = {
'label': 'build-docker-image-' + image_name,
'label': '{}-{}'.format(config.kind, image_name),
'description': description,
'attributes': {
'image_name': image_name,
@ -191,7 +191,7 @@ def fill_template(config, tasks):
else:
worker['docker-image'] = {'in-tree': 'image_builder'}
deps = taskdesc.setdefault('dependencies', {})
deps['docker-image'] = 'build-docker-image-image_builder'
deps['docker-image'] = '{}-image_builder'.format(config.kind)
if packages:
deps = taskdesc.setdefault('dependencies', {})
@ -200,7 +200,7 @@ def fill_template(config, tasks):
if parent:
deps = taskdesc.setdefault('dependencies', {})
deps['parent'] = 'build-docker-image-{}'.format(parent)
deps['parent'] = '{}-{}'.format(config.kind, parent)
worker['env']['PARENT_TASK_ID'] = {
'task-reference': '<parent>',
}

Просмотреть файл

@ -448,7 +448,7 @@ def build_docker_worker_payload(config, task, task_def):
if isinstance(image, dict):
if 'in-tree' in image:
name = image['in-tree']
docker_image_task = 'build-docker-image-' + image['in-tree']
docker_image_task = 'docker-image-' + image['in-tree']
task.setdefault('dependencies', {})['docker-image'] = docker_image_task
image = {