diff --git a/.taskcluster.yml b/.taskcluster.yml index 1aba72b9aa6..0b427e1795d 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -22,7 +22,8 @@ tasks: payload: maxRunTime: {$eval: '20 * 60'} # https://github.com/servo/taskcluster-bootstrap-docker-images#decision-task - image: "servobrowser/taskcluster-bootstrap:decision-task@sha256:28045b7ec0485ef363f8cb14f194008b47e9ede99f2ea40a1e945e921fce976e" + image: "servobrowser/taskcluster-bootstrap:decision-task@\ + sha256:7471a998e4462638c8d3e2cf0b4a99c9a5c8ca9f2ec0ae01cc069473b35cde10" features: taskclusterProxy: true env: @@ -47,18 +48,7 @@ tasks: $if: "event.ref[:11] == 'refs/heads/'" then: "${event.ref[11:]}" in: - $if: >- - ( - taskcluster_root_url == 'https://community-tc.services.mozilla.com' && - branch == 'try-communitytc' - ) || ( - taskcluster_root_url == 'https://taskcluster.net' && - branch != 'try-communitytc' && - ( - branch in ['auto', 'try', 'master'] || - branch[:4] == 'try-' - ) - ) + $if: "branch in ['auto', 'try', 'master'] || branch[:4] == 'try-'" then: $mergeDeep: - {$eval: "task_common"} diff --git a/etc/ci/update-wpt-checkout b/etc/ci/update-wpt-checkout index 1ab4b62ec64..5f8ef9d1a15 100755 --- a/etc/ci/update-wpt-checkout +++ b/etc/ci/update-wpt-checkout @@ -100,7 +100,7 @@ function unsafe_open_pull_request() { git checkout "${BRANCH_NAME}" || return 0 if [[ -z "${WPT_SYNC_TOKEN+set}" && "${TASKCLUSTER_PROXY_URL+set}" == "set" ]]; then - SECRET_RESPONSE=$(curl ${TASKCLUSTER_PROXY_URL}/secrets/v1/secret/project/servo/wpt-sync) + SECRET_RESPONSE=$(curl ${TASKCLUSTER_PROXY_URL}/api/secrets/v1/secret/project/servo/wpt-sync) WPT_SYNC_TOKEN=`echo "${SECRET_RESPONSE}" | jq --raw-output '.secret.token'` fi diff --git a/etc/taskcluster/decision_task.py b/etc/taskcluster/decision_task.py index 358e1af0b3b..148ee81cc0c 100644 --- a/etc/taskcluster/decision_task.py +++ b/etc/taskcluster/decision_task.py @@ -24,6 +24,10 @@ def main(task_for): magicleap_nightly = lambda: None if task_for == "github-push": + if not CONFIG.legacy_tc_deployment: # pragma: no cover + # Do nothing (other than the decision task itsef) on community-tc by default for now + return + # FIXME https://github.com/servo/servo/issues/22187 # In-emulator testing is disabled for now. (Instead we only compile.) # This local variable shadows the module-level function of the same name. @@ -238,7 +242,8 @@ def upload_docs(): .with_scopes("secrets:get:project/servo/doc.servo.org") .with_env(PY="""if 1: import urllib, json - url = "http://taskcluster/secrets/v1/secret/project/servo/doc.servo.org" + root_url = os.environ["TASKCLUSTER_PROXY_URL"] + url = root_url + "/api/secrets/v1/secret/project/servo/doc.servo.org" token = json.load(urllib.urlopen(url))["secret"]["token"] open("/root/.git-credentials", "w").write("https://git:%s@github.com/" % token) """) diff --git a/etc/taskcluster/decisionlib.py b/etc/taskcluster/decisionlib.py index 0436612dafa..976e5cd99d2 100644 --- a/etc/taskcluster/decisionlib.py +++ b/etc/taskcluster/decisionlib.py @@ -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): """ @@ -256,7 +255,7 @@ class Task: extra=self.extra, ) - task_id = taskcluster.slugId().decode("utf8") + task_id = taskcluster.slugId() SHARED.queue_service.createTask(task_id, queue_payload) print("Scheduled %s: %s" % (task_id, self.name)) return task_id @@ -483,7 +482,7 @@ class WindowsGenericWorkerTask(GenericWorkerTask): git += """ git fetch {depth} %GIT_URL% %GIT_REF% git reset --hard %GIT_SHA% - """.format(depth="--depth 1" if shallow else "") + """.format(depth="--depth 100" if shallow else "") return self \ .with_git() \ .with_script(git) \ @@ -605,7 +604,7 @@ class UnixTaskMixin(Task): cd repo git fetch {depth} "$GIT_URL" "$GIT_REF" git reset --hard "$GIT_SHA" - """.format(depth="--depth 1" if shallow else "")) + """.format(depth="--depth 100" if shallow else "")) def with_curl_script(self, url, file_path): self.curl_scripts_count += 1 @@ -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)), ) diff --git a/etc/taskcluster/mock.py b/etc/taskcluster/mock.py index 10fe23b22a1..c0b45e6a1f4 100755 --- a/etc/taskcluster/mock.py +++ b/etc/taskcluster/mock.py @@ -45,6 +45,7 @@ sys.dont_write_bytecode = True os.environ.update(**{k: k for k in "TASK_ID TASK_OWNER TASK_SOURCE GIT_URL GIT_SHA".split()}) os.environ["GIT_REF"] = "refs/heads/auto" os.environ["TASKCLUSTER_ROOT_URL"] = "https://taskcluster.net" +os.environ["TASKCLUSTER_PROXY_URL"] = "http://taskcluster" import decision_task print("\n# Push:") diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py index 40bbd61b92c..a663763a398 100644 --- a/python/servo/package_commands.py +++ b/python/servo/package_commands.py @@ -591,7 +591,7 @@ class PackageCommands(CommandBase): def get_taskcluster_secret(name): url = ( os.environ.get("TASKCLUSTER_PROXY_URL", "http://taskcluster") + - "/secrets/v1/secret/project/servo/" + + "/api/secrets/v1/secret/project/servo/" + name ) return json.load(urllib.request.urlopen(url))["secret"]