Bug 1385094 - Allow support for taskgraph taks to refer to indexed docker images, in addition to in-tree and docker-hub images.
MozReview-Commit-ID: HFmsBswwsA1
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -160,17 +160,19 @@ task_description_schema = Schema({
# For tasks that will run in docker-worker or docker-engine, this is the
# name of the docker image or in-tree docker image to run the task in. If
# in-tree, then a dependency will be created automatically. This is
# generally `desktop-test`, or an image that acts an awful lot like it.
Required('docker-image'): Any(
# a raw Docker image path (repo/image:tag)
basestring,
# an in-tree generated docker image (from `taskcluster/docker/<name>`)
- {'in-tree': basestring}
+ {'in-tree': basestring},
+ # an indexed docker image
+ {'indexed': basestring},
),
# worker features that should be enabled
Required('relengapi-proxy', default=False): bool,
Required('chain-of-trust', default=False): bool,
Required('taskcluster-proxy', default=False): bool,
Required('allow-ptrace', default=False): bool,
Required('loopback-video', default=False): bool,
@@ -563,23 +565,33 @@ def index_builder(name):
@payload_builder('docker-worker')
def build_docker_worker_payload(config, task, task_def):
worker = task['worker']
image = worker['docker-image']
if isinstance(image, dict):
- docker_image_task = 'build-docker-image-' + image['in-tree']
- task.setdefault('dependencies', {})['docker-image'] = docker_image_task
- image = {
- "path": "public/image.tar.zst",
- "taskId": {"task-reference": "<docker-image>"},
- "type": "task-image",
- }
+ if 'in-tree' in image:
+ docker_image_task = 'build-docker-image-' + image['in-tree']
+ task.setdefault('dependencies', {})['docker-image'] = docker_image_task
+
+ image = {
+ "path": "public/image.tar.zst",
+ "taskId": {"task-reference": "<docker-image>"},
+ "type": "task-image",
+ }
+ elif 'indexed' in image:
+ image = {
+ "path": "public/image.tar.zst",
+ "namespace": image['indexed'],
+ "type": "indexed-image",
+ }
+ else:
+ raise Exception("unknown docker image type")
features = {}
if worker.get('relengapi-proxy'):
features['relengAPIProxy'] = True
if worker.get('taskcluster-proxy'):
features['taskclusterProxy'] = True
--- a/taskcluster/taskgraph/transforms/tests.py
+++ b/taskcluster/taskgraph/transforms/tests.py
@@ -211,17 +211,19 @@ test_description_schema = Schema({
# in-tree, then a dependency will be created automatically. This is
# generally `desktop-test`, or an image that acts an awful lot like it.
Required('docker-image', default={'in-tree': 'desktop-test'}): optionally_keyed_by(
'test-platform',
Any(
# a raw Docker image path (repo/image:tag)
basestring,
# an in-tree generated docker image (from `taskcluster/docker/<name>`)
- {'in-tree': basestring}
+ {'in-tree': basestring},
+ # an indexed docker image
+ {'indexed': basestring},
)
),
# seconds of runtime after which the task will be killed. Like 'chunks',
# this can be keyed by test pltaform.
Required('max-run-time', default=3600): optionally_keyed_by(
'test-platform',
int),