Fix name and working_directory of imported tasks (#796)
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 44378d0..873fada 100755
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -677,17 +677,29 @@
namespace = import_name.partition(".")[0]
tasks = {}
for task_name, task_config in imported_config["tasks"].items():
- if "platform" not in task_config:
- task_config["platform"] = task_name
- for field in ["name", "working_directory"]:
- if field not in task_config:
- task_config[field] = namespace
-
+ fix_imported_task_platform(task_name, task_config)
+ fix_imported_task_name(namespace, task_config)
+ fix_imported_task_working_directory(namespace, task_config)
tasks["%s_%s" % (namespace, task_name)] = task_config
return tasks
+def fix_imported_task_platform(task_name, task_config):
+ if "platform" not in task_config:
+ task_config["platform"] = task_name
+
+
+def fix_imported_task_name(namespace, task_config):
+ old_name = task_config.get("name")
+ task_config["name"] = "%s (%s)" % (namespace, old_name) if old_name else namespace
+
+
+def fix_imported_task_working_directory(namespace, task_config):
+ old_dir = task_config.get("working_directory")
+ task_config["working_directory"] = os.path.join(namespace, old_dir) if old_dir else namespace
+
+
def print_collapsed_group(name):
eprint("\n\n--- {0}\n\n".format(name))