mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Add Terraform config for docker-worker on Packet.net
This commit is contained in:
parent
ba8b37f3bc
commit
6fa0c6bbf7
6 changed files with 163 additions and 8 deletions
35
etc/taskcluster/packet.net/tc.py
Normal file
35
etc/taskcluster/packet.net/tc.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# 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 http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
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 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)
|
Loading…
Add table
Add a link
Reference in a new issue