diff --git a/etc/taskcluster/packet.net/.gitignore b/etc/taskcluster/packet.net/.gitignore deleted file mode 100644 index a82a34900dc..00000000000 --- a/etc/taskcluster/packet.net/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.terraform* -terraform.tfstate* \ No newline at end of file diff --git a/etc/taskcluster/packet.net/README.md b/etc/taskcluster/packet.net/README.md deleted file mode 100644 index 408a28ba329..00000000000 --- a/etc/taskcluster/packet.net/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# docker-worker on Packet.net - -This is the configuration for the `proj-servo/docker-worker-kvm` worker type. -It is similar to `aws-provisioner/docker-worker`, -except that it runs on a server from Packet.net. -This server is “real” non-virtualized hardware, -so that Intel VT-x instructions are available and we can run KVM. -KVM is required for the Android emulator’s CPU acceleration, -which in turn is required to run OpenGL ES 3 (not just 2) in the guest system. - -## Setup - -* [Install Terraform](https://www.terraform.io/downloads.html) -* [Install taskcluster-cli](https://github.com/taskcluster/taskcluster-cli/#installation) -* Run ``eval `taskcluster signin` `` (once per open terminal/shell) -* Run `./terraform_with_vars.py init` (once per checkout of the Servo repository) - -## List running servers - -* Run `./list_devices.py` - -## (Re)deploying a server - -* Run `./terraform_with_vars.py plan` -* If the plan looks good, run `./terraform_with_vars.py apply` -* Watch the new server being installed. Terraform should finish in 15~20 minutes. - -## Taskcluster secrets - -`terraform_with_vars.py` uses Taskcluster’s -[secrets service](https://tools.taskcluster.net/secrets/). -These secrets include an [authentication token]( -https://app.packet.net/projects/e3d0d8be-9e4c-4d39-90af-38660eb70544/settings/api-keys) -for Packet.net’s API. -You’ll need to authenticate with a Taskcluster client ID -that has scope `secrets:get:project/servo/*`. -This should be the case if you’re a Servo project administrator (the `project-admin:servo` role). - -## Worker’s client ID - -Workers are configured to authenticate with client ID -[`project/servo/worker/docker-worker-kvm/1`]( -https://tools.taskcluster.net/auth/clients/project%2Fservo%2Fworker%2Fdocker-worker-kvm%2F1). -This client has the scopes required to run docker-worker -as well as for tasks that we run on this worker type. \ No newline at end of file diff --git a/etc/taskcluster/packet.net/docker-worker.tf b/etc/taskcluster/packet.net/docker-worker.tf deleted file mode 100644 index f6ecc64783d..00000000000 --- a/etc/taskcluster/packet.net/docker-worker.tf +++ /dev/null @@ -1,29 +0,0 @@ -module "docker_worker_packet" { - source = "github.com/servo/taskcluster-infrastructure//modules/docker-worker?ref=424ea4ff13de34df70e5242706fe1e26864cc383" - - packet_project_id = "e3d0d8be-9e4c-4d39-90af-38660eb70544" - packet_instance_type = "t1.small.x86" - number_of_machines = "1" - concurrency = "1" - - provisioner_id = "proj-servo" - worker_type = "docker-worker-kvm" - worker_group_prefix = "servo-packet" - - taskcluster_client_id = "${var.taskcluster_client_id}" - taskcluster_access_token = "${var.taskcluster_access_token}" - ssl_certificate = "${var.ssl_certificate}" - cert_key = "${var.cert_key}" - ssh_pub_key = "${var.ssh_pub_key}" - ssh_priv_key = "${var.ssh_priv_key}" - private_key = " " - relengapi_token = " " - stateless_hostname = " " -} - -variable "taskcluster_client_id" {} -variable "taskcluster_access_token" {} -variable "ssl_certificate" {} -variable "cert_key" {} -variable "ssh_pub_key" {} -variable "ssh_priv_key" {} \ No newline at end of file diff --git a/etc/taskcluster/packet.net/list_devices.py b/etc/taskcluster/packet.net/list_devices.py deleted file mode 100755 index 3c40391a941..00000000000 --- a/etc/taskcluster/packet.net/list_devices.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/python3 - -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -import json -import sys -import urllib.request - -import tc - - -SERVO_PROJECT_ID = "e3d0d8be-9e4c-4d39-90af-38660eb70544" -PACKET_AUTH_TOKEN = None - - -def main(): - tc.check() - global PACKET_AUTH_TOKEN - PACKET_AUTH_TOKEN = tc.packet_auth_token() - response = api_request("/projects/%s/devices?per_page=1000" % SERVO_PROJECT_ID) - for device in response["devices"]: - print(device["id"]) - print(" Hostname:\t" + device["hostname"]) - print(" Plan:\t" + device["plan"]["name"]) - print(" OS: \t" + device["operating_system"]["name"]) - for address in device["ip_addresses"]: - if address["public"]: - print(" IPv%s:\t%s" % (address["address_family"], address["address"])) - print(" Created:\t" + device["created_at"].replace("T", " ")) - print(" Updated:\t" + device["updated_at"].replace("T", " ")) - assert response["meta"]["next"] is None - - -def api_request(path, json_data=None, method=None): - request = urllib.request.Request("https://api.packet.net" + path, method=method) - request.add_header("X-Auth-Token", PACKET_AUTH_TOKEN) - if json_data is not None: - request.add_header("Content-Type", "application/json") - request.data = json.dumps(json_data) - with urllib.request.urlopen(request) as response: - return json.load(response) - - -if __name__ == "__main__": - main(*sys.argv[1:]) diff --git a/etc/taskcluster/packet.net/tc.py b/etc/taskcluster/packet.net/tc.py deleted file mode 100644 index 355ec4a1a33..00000000000 --- a/etc/taskcluster/packet.net/tc.py +++ /dev/null @@ -1,52 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -import os -import sys -import json -import base64 -import subprocess - - -def check(): - try: - subprocess.check_output(["taskcluster", "version"]) - except FileNotFoundError: # noqa: F821 - sys.exit("taskcluster CLI tool not available. Install it from " - "https://github.com/taskcluster/taskcluster-cli#installation") - - if "TASKCLUSTER_CLIENT_ID" not in os.environ or "TASKCLUSTER_ACCESS_TOKEN" not in os.environ: - sys.exit("Taskcluster API credentials not available. Run this command and try again:\n\n" - "eval `taskcluster signin`\n") - - -def livelog(): - win2016 = secret("worker-type:aws-provisioner-v1/servo-win2016") - files = win2016["files"] - assert all(f["encoding"] == "base64" for f in files) - files = {f.get("description"): f["content"] for f in files} - cert = files["SSL certificate for livelog"] - key = files["SSL key for livelog"] - return { - "livelog_cert_base64": cert, - "livelog_key_base64": key, - "livelog_cert": base64.b64decode(cert), - "livelog_key": base64.b64decode(key), - "livelog_secret": win2016["config"]["livelogSecret"], - } - - -def packet_auth_token(): - return secret("project/servo/packet.net-api-key")["key"] - - -def secret(name): - return api("secrets", "get", name)["secret"] - - -def api(*args): - args = ["taskcluster", "api"] + list(args) - output = subprocess.check_output(args) - if output: - return json.loads(output) diff --git a/etc/taskcluster/packet.net/terraform_with_vars.py b/etc/taskcluster/packet.net/terraform_with_vars.py deleted file mode 100755 index 413cf742db6..00000000000 --- a/etc/taskcluster/packet.net/terraform_with_vars.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python3 - -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -import os -import sys -import subprocess - -import tc - - -def main(*args): - tc.check() - ssh_key = tc.secret("project/servo/ssh-keys/docker-worker-kvm") - tc_creds = tc.secret("project/servo/tc-client/worker/docker-worker-kvm/1") - livelog = tc.livelog() - - terraform_vars = dict( - ssh_pub_key=ssh_key["public"], - ssh_priv_key=ssh_key["private"], - taskcluster_client_id=tc_creds["client_id"], - taskcluster_access_token=tc_creds["access_token"], - packet_api_key=tc.packet_auth_token(), - ssl_certificate=livelog["livelog_cert_base64"], - cert_key=livelog["livelog_key_base64"], - ) - env = dict(os.environ) - env["PACKET_AUTH_TOKEN"] = terraform_vars["packet_api_key"] - env.update({"TF_VAR_" + k: v for k, v in terraform_vars.items()}) - cwd = os.path.abspath(os.path.dirname(__file__)) - sys.exit(subprocess.call(["terraform"] + list(args), env=env, cwd=cwd)) - - -if __name__ == "__main__": - main(*sys.argv[1:])