Bug 1316749: use taskcluster-proxy to hit index for docker image optimization; r?jonasfj
MozReview-Commit-ID: 9AL7HhBdjE1
--- 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)