Bug 1274645: generate task labels for docker image builds; r?ahal
This monkey-patches the old taskcluster_graph code to avoid impacting branches
that are still using that support for decision graphs. All of this will go
away when docker image builds become their own kind.
MozReview-Commit-ID: KukC3qqZDYA
--- a/taskcluster/taskgraph/kind/legacy.py
+++ b/taskcluster/taskgraph/kind/legacy.py
@@ -54,16 +54,20 @@ DEFAULT_JOB_PATH = os.path.join(
# time after which a try build's results will expire
TRY_EXPIRATION = "14 days"
logger = logging.getLogger(__name__)
def mklabel():
return TASKID_PLACEHOLDER.format(slugid())
+# monkey-patch mklabel into image_builder, as well
+from taskcluster_graph import image_builder
+image_builder.mklabel = mklabel
+
def set_expiration(task, timestamp):
task_def = task['task']
task_def['expires'] = timestamp
if task_def.get('deadline', timestamp) > timestamp:
task_def['deadline'] = timestamp
try:
artifacts = task_def['payload']['artifacts']
--- a/testing/taskcluster/taskcluster_graph/image_builder.py
+++ b/testing/taskcluster/taskcluster_graph/image_builder.py
@@ -17,16 +17,22 @@ DOCKER_ROOT = os.path.join(GECKO, 'testi
REGISTRY = open(os.path.join(DOCKER_ROOT, 'REGISTRY')).read().strip()
INDEX_URL = 'https://index.taskcluster.net/v1/task/docker.images.v1.{}.{}.hash.{}'
ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}'
DEFINE_TASK = 'queue:define-task:aws-provisioner-v1/{}'
def is_docker_registry_image(registry_path):
return os.path.isfile(registry_path)
+# make a task label; in old decision tasks, this is a regular slugid, but when called
+# from the taskgraph generator's legacy kind, this is monkey-patched to return a label
+# (`TaskLabel==..`)
+def mklabel():
+ return slugid()
+
def docker_image(name):
''' Determine the docker tag/revision from an in tree docker file '''
repository_path = os.path.join(DOCKER_ROOT, name, 'REGISTRY')
repository = REGISTRY
version = open(os.path.join(DOCKER_ROOT, name, 'VERSION')).read().strip()
if os.path.isfile(repository_path):
@@ -44,17 +50,17 @@ def task_id_for_image(seen_images, proje
if task_id:
seen_images[name] = {'taskId': task_id}
return task_id
if not create:
return None
- task_id = slugid()
+ task_id = mklabel()
seen_images[name] = {
'taskId': task_id,
'path': context_path,
'hash': context_hash
}
return task_id