Skip to content

Commit a9e949f

Browse files
committed
src/trigger.py: Retrieve externally hosted build configurations
This patch enables external config retrieval. It is currently limited to trees hosted on Kernel.org and GitHub and will be soon extended to cover a generic use-case. Signed-off-by: Paweł Wieczorek <[email protected]>
1 parent a2f30dd commit a9e949f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/trigger.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import copy
1010
from datetime import datetime, timedelta
1111
import sys
12+
import tempfile
1213
import time
1314

1415
import kernelci.build
@@ -138,6 +139,26 @@ def _run_trigger(self, build_config, force, timeout, trees):
138139
def _iterate_trees(self, force, timeout, trees):
139140
for tree in self._trees.keys():
140141
build_configs = {name: config for name, config in self._build_configs.items() if config.tree.name == tree}
142+
if not build_configs:
143+
try:
144+
# Remove hardcoded remote build config paths
145+
if tree.url.startswith("https://git.kernel.org"):
146+
config_url = f"{tree.url}/plain/.kernelci.yaml?h=kernelci"
147+
elif tree.url.startswith("https://github.com"):
148+
config_url = f"https://raw.githubusercontent.com/{tree}/linux/refs/heads/kernelci/.kernelci.yaml"
149+
else:
150+
raise Exception("Hosting service not supported")
151+
remote_config = requests.get(config_url)
152+
except Exception as ex:
153+
self.log.error(f"Failed to get remote build config for {tree.name}, ignoring")
154+
self.traceback(ex)
155+
continue
156+
with tempfile.NamedTemporaryFile(suffix='.yaml', delete_on_close=False) as tmp:
157+
tmp.write(remote_config.text.encode())
158+
tmp.close()
159+
# Remove hardcoded trees config path
160+
tmp_configs = kernelci.config.load(['config/trees.yaml', tmp.name])
161+
build_configs = tmp_configs['build_configs']
141162
for name, config in build_configs.items():
142163
self._run_trigger(config, force, timeout, trees)
143164

0 commit comments

Comments
 (0)