Bug 1316749: use taskcluster-proxy to hit index for docker image optimization; r?jonasfj draft
authorDustin J. Mitchell <dustin@mozilla.com>
Fri, 06 Jan 2017 19:58:30 +0000
changeset 457123 eee74703845c0fbcc59b4e52876bda8371ccdbc8
parent 455998 8a281e6c7c56a7aa2d77b556f42fedfa2baa365a
child 541392 d4e0d8930883f6e853e4249ec7f9d75b2d6c14f8
push id40679
push userdmitchell@mozilla.com
push dateFri, 06 Jan 2017 20:10:46 +0000
reviewersjonasfj
bugs1316749
milestone53.0a1
Bug 1316749: use taskcluster-proxy to hit index for docker image optimization; r?jonasfj MozReview-Commit-ID: 9AL7HhBdjE1
taskcluster/taskgraph/task/docker_image.py
--- a/taskcluster/taskgraph/task/docker_image.py
+++ b/taskcluster/taskgraph/task/docker_image.py
@@ -14,18 +14,25 @@ from taskgraph.util.docker import (
     docker_image,
     generate_context_hash,
     INDEX_PREFIX,
 )
 from taskgraph.util.templates import Templates
 
 logger = logging.getLogger(__name__)
 GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..', '..'))
-ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}'
-INDEX_URL = 'https://index.taskcluster.net/v1/task/{}'
+
+# if running in a task, prefer to use the taskcluster proxy (http://taskcluster/),
+# otherwise hit the services directly
+if os.environ.get('TASK_ID'):
+    ARTIFACT_URL = 'http://taskcluster/queue/v1/task/{}/artifacts/{}'
+    INDEX_URL = 'http://taskcluster/index/v1/task/{}'
+else:
+    ARTIFACT_URL = 'https://queue.taskcluster.net/v1/task/{}/artifacts/{}'
+    INDEX_URL = 'https://index.taskcluster.net/v1/task/{}'
 
 
 class DockerImageTask(base.Task):
 
     def __init__(self, *args, **kwargs):
         self.index_paths = kwargs.pop('index_paths')
         super(DockerImageTask, self).__init__(*args, **kwargs)