imgtestlib: support bootc-foundry image types#2393
Open
lzap wants to merge 1 commit into
Open
Conversation
It looks like recent refactoring broke the boot tests for bootc-foundry images. This commit fixes the issue by updating the image type detection logic to handle the new format.
Member
|
Which recent refactoring? Tests are failing here. Found it; it got changed in this commit: 65682dc (cc @achilleas-k) note the change in implementation for Perhaps we should go back to the previous def find_image_file(build_path: str) -> str:
"""
Find the path to the image by reading the manifest and finding the exported pipeline's output directory.
A manifest may contain multiple pipelines but only one is exported during a build. This function finds the
exported pipeline by checking which pipeline directory exists in the build output.
Raises RuntimeError if no or multiple exported directories are found, or if the directory doesn't contain
exactly one file.
"""
manifest_file = os.path.join(build_path, "manifest.json")
with open(manifest_file, encoding="utf-8") as manifest:
data = json.load(manifest)
pipeline_names = [p["name"] for p in data["pipelines"] if p["name"] != "build"]
export_dirs = [p for p in pipeline_names if os.path.isdir(os.path.join(build_path, p))]
if len(export_dirs) != 1:
raise RuntimeError(f"Expected exactly one exported pipeline directory in {build_path}, found: {export_dirs}")
files = os.listdir(os.path.join(build_path, export_dirs[0]))
if len(files) != 1:
raise RuntimeError(
f"Expected exactly one file in export directory '{export_dirs[0]}', found: {files}")
return os.path.join(build_path, export_dirs[0], files[0])? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It looks like recent refactoring broke the boot tests for bootc-foundry images. This commit fixes the issue by updating the image type detection logic to handle the new format.
Solves:
I do not understand why we do this for bootc manifests, so unsure if this is a proper solution to the problem.