Bug 1275409: remove testing/taskcluster/mach_commands.py, except 'mach taskcluster-load-image'; r=wcosta
MozReview-Commit-ID: BrhXVWT5r8D
This commit is contained in:
@@ -20,6 +20,8 @@ from mach.decorators import (
|
||||
|
||||
from mozbuild.base import MachCommandBase
|
||||
|
||||
ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}'
|
||||
|
||||
|
||||
class ShowTaskGraphSubCommand(SubCommand):
|
||||
"""A SubCommand with TaskGraph-specific arguments"""
|
||||
@@ -203,3 +205,37 @@ class MachCommands(MachCommandBase):
|
||||
# disassemble the dictionary
|
||||
for task in taskgraph.to_json().itervalues():
|
||||
print(json.dumps(task))
|
||||
|
||||
|
||||
@CommandProvider
|
||||
class LoadImage(object):
|
||||
@Command('taskcluster-load-image', category="ci",
|
||||
description="Load a pre-built Docker image")
|
||||
@CommandArgument('--task-id',
|
||||
help="Load the image at public/image.tar in this task, rather than "
|
||||
"searching the index")
|
||||
@CommandArgument('image_name', nargs='?',
|
||||
help="Load the image of this name based on the current contents of the tree "
|
||||
"(as built for mozilla-central or mozilla-inbound)")
|
||||
def load_image(self, image_name, task_id):
|
||||
from taskcluster_graph.image_builder import (
|
||||
task_id_for_image,
|
||||
docker_load_from_url
|
||||
)
|
||||
|
||||
if not image_name and not task_id:
|
||||
print("Specify either IMAGE-NAME or TASK-ID")
|
||||
sys.exit(1)
|
||||
|
||||
if not task_id:
|
||||
task_id = task_id_for_image({}, 'mozilla-inbound', image_name, create=False)
|
||||
if not task_id:
|
||||
print("No task found in the TaskCluster index for", image_name)
|
||||
sys.exit(1)
|
||||
|
||||
print("Task ID:", task_id)
|
||||
|
||||
ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}'
|
||||
image_name = docker_load_from_url(ARTIFACT_URL.format(task_id, 'public/image.tar'))
|
||||
|
||||
print("Loaded image is named", image_name)
|
||||
|
||||
Reference in New Issue
Block a user