19
19
20
20
PLATFORM_TO_NAMESPACE = {
21
21
"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" ,
23
32
}
24
33
LOG_SECONDS_TO_QUERY = 10
25
34
SECONDS_QUERY_LOGS_EVERY = 5
26
35
27
36
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 :
29
40
"""Spawns a pod to run the specified commands.
30
41
31
42
Args:
32
43
k8s_client: The kubernetes client instance to use for spawning the pod.
33
44
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 .
35
46
commands: The commands to run upon pod start.
47
+ args: Arguments to pass to the command upon pod start.
36
48
"""
49
+ taint_key , taint_value = PLATFORM_TAINT [platform ]
37
50
pod_definition = {
38
51
"apiVersion" : "v1" ,
39
52
"kind" : "Pod" ,
40
53
"metadata" : {
41
54
"name" : pod_name ,
42
- "namespace" : namespace ,
55
+ "namespace" : PLATFORM_TO_NAMESPACE [ platform ] ,
43
56
},
44
57
"spec" : {
45
58
"tolerations" : [
46
59
{
47
- "key" : "buildbot-platform" ,
60
+ "key" : taint_key ,
48
61
"operator" : "Equal" ,
49
- "value" : "linux" ,
62
+ "value" : taint_value ,
50
63
"effect" : "NoSchedule" ,
51
64
}
52
65
],
53
- "nodeSelector" : {"buildbot-platform" : "linux" },
66
+ "nodeSelector" : {
67
+ "buildbot-platform" : PLATFORM_TO_BUILDBOT_PLATFORM [platform ]
68
+ },
54
69
"containers" : [
55
70
{
56
71
"name" : "build" ,
57
- "image" : "ghcr.io/llvm/ci-ubuntu-24.04" ,
72
+ "image" : PLATFORM_CONTAINER [ platform ] ,
58
73
"command" : commands ,
74
+ "args" : args ,
59
75
"resources" : {
60
76
"requests" : {"cpu" : 55 , "memory" : "200Gi" },
61
77
"limits" : {"cpu" : 64 , "memory" : "256Gi" },
@@ -83,10 +99,7 @@ def start_build_linux(commit_sha: str, k8s_client) -> str:
83
99
"echo BUILD FINISHED" ,
84
100
]
85
101
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 )], []
90
103
)
91
104
return pod_name
92
105
@@ -97,18 +110,19 @@ def start_build_windows(commit_sha: str, k8s_client):
97
110
bash_commands = [
98
111
"git clone --depth 100 https://github.com/llvm/llvm-project" ,
99
112
"cd llvm-project" ,
100
- f"git checkout $ { commit_sha } " ,
113
+ f"git checkout { commit_sha } " ,
101
114
"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"',
103
117
"echo BUILD FINISHED" ,
104
118
]
119
+ bash_command = f"bash -c \" { ';' .join (bash_commands )} \" \" "
105
120
commands = [
106
121
"call C:\\ BuildTools\\ Common7\\ Tools\\ VsDevCmd.bat -arch=amd64 -host_arch=amd64" ,
107
- "bash" ,
108
- "-c" ,
109
- ";" .join (bash_commands ),
122
+ bash_command ,
110
123
]
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 )
112
126
return pod_name
113
127
114
128
0 commit comments