mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Always construct TC API URLs from $TASKCLUSTER_PROXY_URL or $TASKCLUSTER_ROOT_URL
This commit is contained in:
parent
2aca5c82e4
commit
08705345d6
5 changed files with 15 additions and 11 deletions
|
@ -57,8 +57,8 @@ class Config:
|
|||
self.git_ref = os.environ.get("GIT_REF")
|
||||
self.git_sha = os.environ.get("GIT_SHA")
|
||||
|
||||
root_url = os.environ.get("TASKCLUSTER_ROOT_URL")
|
||||
self.legacy_tc_deployment = root_url == "https://taskcluster.net"
|
||||
self.tc_root_url = os.environ.get("TASKCLUSTER_ROOT_URL")
|
||||
self.legacy_tc_deployment = self.tc_root_url == "https://taskcluster.net"
|
||||
|
||||
if self.legacy_tc_deployment:
|
||||
self.default_provisioner_id = "aws-provisioner-v1"
|
||||
|
@ -99,10 +99,9 @@ class Shared:
|
|||
self.now = datetime.datetime.utcnow()
|
||||
self.found_or_created_indexed_tasks = {}
|
||||
|
||||
# taskclusterProxy URLs:
|
||||
# https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/features
|
||||
self.queue_service = taskcluster.Queue(options={"baseUrl": "http://taskcluster/queue/v1/"})
|
||||
self.index_service = taskcluster.Index(options={"baseUrl": "http://taskcluster/index/v1/"})
|
||||
options = {"rootUrl": os.environ["TASKCLUSTER_PROXY_URL"]}
|
||||
self.queue_service = taskcluster.Queue(options)
|
||||
self.index_service = taskcluster.Index(options)
|
||||
|
||||
def from_now_json(self, offset):
|
||||
"""
|
||||
|
@ -621,11 +620,14 @@ class UnixTaskMixin(Task):
|
|||
""".format(n=n))
|
||||
|
||||
def with_curl_artifact_script(self, task_id, artifact_name, out_directory=""):
|
||||
if CONFIG.legacy_tc_deployment:
|
||||
queue_service = "https://queue.taskcluster.net"
|
||||
else: # pragma: no cover
|
||||
queue_service = CONFIG.tc_root_url + "/api/queue"
|
||||
return self \
|
||||
.with_dependencies(task_id) \
|
||||
.with_curl_script(
|
||||
"https://queue.taskcluster.net/v1/task/%s/artifacts/public/%s"
|
||||
% (task_id, artifact_name),
|
||||
queue_service + "/v1/task/%s/artifacts/public/%s" % (task_id, artifact_name),
|
||||
os.path.join(out_directory, url_basename(artifact_name)),
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue