Skip to content

Commit a6d78cc

Browse files
committed
components
1 parent 4ee78f5 commit a6d78cc

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

ci/cached-builds/konflux_generate_component_definitions.py

+7-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
2+
import pathlib
33
import re
44
import yaml
55

@@ -17,6 +17,8 @@
1717
and see the result in the "Components" tab.
1818
"""
1919

20+
ROOT_DIR = pathlib.Path(__file__).parent.parent.parent
21+
2022
workspace_name = "rhoai-ide-konflux-tenant"
2123
application_name = "notebooks"
2224
application_uid = "eb0420e2-5bf3-42ef-848d-cc85c265b7dd"
@@ -74,27 +76,15 @@ def konflux_component(component_name, dockerfile_path) -> dict:
7476

7577

7678
def main():
77-
with open("Makefile", "rt") as makefile:
78-
lines = gen_gha_matrix_jobs.read_makefile_lines(makefile)
79-
tree: dict[str, list[str]] = gen_gha_matrix_jobs.extract_target_dependencies(lines)
80-
81-
for task, deps in tree.items():
82-
# in level 0, we only want base images, not other utility tasks
83-
if not deps:
84-
if not task.startswith("base-"):
85-
continue
86-
87-
# we won't build rhel-based images because they need a subscription
88-
if "rhel" in task:
89-
continue
90-
79+
images = gen_gha_matrix_jobs.extract_image_targets(makefile_dir=str(ROOT_DIR))
80+
for task in images:
9181
task_name = re.sub(r"[^-_0-9A-Za-z]", "-", task)
92-
dirs = gha_pr_changed_files.analyze_build_directories(task)
82+
dockerfile = gha_pr_changed_files.get_build_dockerfile(task)
9383

9484
print("---")
9585
print(
9686
yaml.dump(
97-
konflux_component(task_name, dockerfile_path=dirs[-1] + "/Dockerfile")
87+
konflux_component(task_name, dockerfile_path=dockerfile)
9888
)
9989
)
10090

0 commit comments

Comments
 (0)