Skip to content

Commit 1ed43fb

Browse files
[CI] Get dispatch_job.py Working for Windows
dispatch_job.py had some issues working on Windows, namely around the scripts not actually working. This patch fixes that.
1 parent 3b16eed commit 1ed43fb

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

zorg/buildbot/builders/annotated/premerge/dispatch_job.py

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,59 @@
1919

2020
PLATFORM_TO_NAMESPACE = {
2121
"Linux": "llvm-premerge-linux-buildbot",
22-
"Windows": "llvm-premerge-windows-buildbot",
22+
"Windows": "llvm-premerge-windows-2022-buildbot",
23+
}
24+
PLATFORM_TAINT = {
25+
"Linux": ("buildbot-platform", "linux"),
26+
"Windows": ("node.kubernetes.io/os", "windows"),
27+
}
28+
PLATFORM_TO_BUILDBOT_PLATFORM = {"Linux": "linux", "Windows": "windows-2022"}
29+
PLATFORM_CONTAINER = {
30+
"Linux": "ghcr.io/llvm/ci-ubuntu-24.04",
31+
"Windows": "ghcr.io/llvm/ci-windows-2022",
2332
}
2433
LOG_SECONDS_TO_QUERY = 10
2534
SECONDS_QUERY_LOGS_EVERY = 5
2635

2736

28-
def start_build(k8s_client, pod_name: str, namespace: str, commands: list[str]) -> None:
37+
def start_build(
38+
k8s_client, pod_name: str, platform: str, commands: list[str], args: list[str]
39+
) -> None:
2940
"""Spawns a pod to run the specified commands.
3041
3142
Args:
3243
k8s_client: The kubernetes client instance to use for spawning the pod.
3344
pod_name: The name of the pod to start.
34-
namespace: The namespace to launch the pod in.
45+
platform: The platform to launch the pod on.
3546
commands: The commands to run upon pod start.
47+
args: Arguments to pass to the command upon pod start.
3648
"""
49+
taint_key, taint_value = PLATFORM_TAINT[platform]
3750
pod_definition = {
3851
"apiVersion": "v1",
3952
"kind": "Pod",
4053
"metadata": {
4154
"name": pod_name,
42-
"namespace": namespace,
55+
"namespace": PLATFORM_TO_NAMESPACE[platform],
4356
},
4457
"spec": {
4558
"tolerations": [
4659
{
47-
"key": "buildbot-platform",
60+
"key": taint_key,
4861
"operator": "Equal",
49-
"value": "linux",
62+
"value": taint_value,
5063
"effect": "NoSchedule",
5164
}
5265
],
53-
"nodeSelector": {"buildbot-platform": "linux"},
66+
"nodeSelector": {
67+
"buildbot-platform": PLATFORM_TO_BUILDBOT_PLATFORM[platform]
68+
},
5469
"containers": [
5570
{
5671
"name": "build",
57-
"image": "ghcr.io/llvm/ci-ubuntu-24.04",
72+
"image": PLATFORM_CONTAINER[platform],
5873
"command": commands,
74+
"args": args,
5975
"resources": {
6076
"requests": {"cpu": 55, "memory": "200Gi"},
6177
"limits": {"cpu": 64, "memory": "256Gi"},
@@ -83,10 +99,7 @@ def start_build_linux(commit_sha: str, k8s_client) -> str:
8399
"echo BUILD FINISHED",
84100
]
85101
start_build(
86-
k8s_client,
87-
pod_name,
88-
PLATFORM_TO_NAMESPACE["Linux"],
89-
["/bin/bash", "-c", ";".join(commands)],
102+
k8s_client, pod_name, "Linux", ["/bin/bash", "-c", ";".join(commands)], []
90103
)
91104
return pod_name
92105

@@ -97,18 +110,19 @@ def start_build_windows(commit_sha: str, k8s_client):
97110
bash_commands = [
98111
"git clone --depth 100 https://github.com/llvm/llvm-project",
99112
"cd llvm-project",
100-
f"git checkout ${commit_sha}",
113+
f"git checkout {commit_sha}",
101114
"export POSTCOMMIT_CI=1",
102-
'.ci/monolithic-windows.sh "clang;clang-tools-extra;libclc;lld;llvm;mlir;polly" "check-clang check-clang-cir check-clang-tools check-lld check-llvm check-mlir check-polly"',
115+
".ci/monolithic-windows.sh 'polly;mlir' 'check-polly check-mlir'",
116+
#'.ci/monolithic-windows.sh "clang;clang-tools-extra;libclc;lld;llvm;mlir;polly" "check-clang check-clang-cir check-clang-tools check-lld check-llvm check-mlir check-polly"',
103117
"echo BUILD FINISHED",
104118
]
119+
bash_command = f"bash -c \"{';'.join(bash_commands)}\"\""
105120
commands = [
106121
"call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64",
107-
"bash",
108-
"-c",
109-
";".join(bash_commands),
122+
bash_command,
110123
]
111-
start_build(k8s_client, pod_name, PLATFORM_TO_NAMESPACE["Windows"], commands)
124+
args = ["/c " + " && ".join(commands)]
125+
start_build(k8s_client, pod_name, "Windows", ["cmd.exe"], args)
112126
return pod_name
113127

114128

0 commit comments

Comments
 (0)