def parser_push():
parser = argparse.ArgumentParser()
parser.add_argument("--tag",
help="Tag to use (default is taken from .taskcluster.yml)")
parser.add_argument("--force", action="store_true",
help="Ignore warnings and push anyway") return parser
def walk_yaml(root, target):
rv = [] if isinstance(root, list): for value in root: if isinstance(value, (dict, list)):
rv.extend(walk_yaml(value, target)) elif isinstance(root, dict): for key, value in root.items(): if isinstance(value, (dict, list)):
rv.extend(walk_yaml(value, target)) elif key == target:
rv.append(value) return rv
def read_image_name(): import yaml with open(os.path.join(wpt_root, ".taskcluster.yml")) as f:
taskcluster_data = yaml.safe_load(f)
taskcluster_values = set(walk_yaml(taskcluster_data, "image")) with open(os.path.join(wpt_root, "tools", "ci", "tc", "tasks", "test.yml")) as f:
test_data = yaml.safe_load(f)
tests_value = test_data["components"]["wpt-base"]["image"] return taskcluster_values, tests_value
def tag_exists(tag):
retcode = subprocess.call(["docker", "manifest", "inspect", tag]) # The command succeeds if the tag exists. return retcode != 0
error_log = logger.warning if force else logger.error if len(taskcluster_tags) != 0 or tests_tag != taskcluster_tag:
error_log("Image names in .taskcluster.yml and tools/ci/tc/tasks/test.yml " "don't match.") ifnot force:
sys.exit(1) if tag isnotNoneand tag != taskcluster_tag:
error_log("Supplied tag doesn't match .taskcluster.yml or " "tools/ci/tc/tasks/test.yml; remember to update before pushing") ifnot force:
sys.exit(1) if tag isNone:
logger.info("Using tag %s from .taskcluster.yml" % taskcluster_tag)
tag = taskcluster_tag
tag_re = re.compile(r"ghcr.io/web-platform-tests/wpt:\d+") ifnot tag_re.match(tag):
error_log("Tag doesn't match expected format ghcr.io/web-platform-tests/wpt:x") ifnot force:
sys.exit(1)
if tag_exists(tag): # No override for this case
logger.critical("Tag %s already exists" % tag)
sys.exit(1)
def parser_run():
parser = argparse.ArgumentParser()
parser.add_argument("--rebuild", action="store_true", help="Force rebuild of image")
parser.add_argument("--checkout",
help="Revision to checkout in the image. " "If this is not supplied we mount the wpt checkout on the host as " "/home/test/web-platform-tests/")
parser.add_argument("--privileged", action="store_true",
help="Run the image in priviledged mode (required for emulators)")
parser.add_argument("--tag", default="wpt:local",
help="Docker image tag to use (default wpt:local)") return parser
def run(*args, **kwargs): if kwargs["rebuild"]:
build()
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.