Revision control

Copy as Markdown

# 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
import subprocess
from taskgraph.transforms.base import TransformSequence
from taskgraph.util.schema import resolve_keyed_by
from taskgraph.util.memoize import memoize
transforms = TransformSequence()
# TODO: Bug 1637695 to be removed once we retire these old indexes
'android': '{sha}',
'desktop-linux': '{sha}',
'desktop-macos': '{sha}',
def git_sha_for_directory(directory):
output = subprocess.check_output(["git", "rev-parse", f"HEAD:{directory}"])
sha = output.decode("utf8").strip()
return sha
def resolve_keys(config, tasks):
for task in tasks:
resolve_keyed_by(task, "routes", item_name=task["name"], **{
"tasks-for": config.params["tasks_for"]
# TODO: Bug 1637695 - temp solution to unblock local building of
# appplication-services. Once we switch to new indexes, we should clean this up
if task['name'] in TOOLCHAIN_OLD_INDEX.keys() and config.params["level"] == "3":
sha = git_sha_for_directory("libs")
routes = task['routes']
yield task