@@ -169,8 +169,24 @@ def get_layer_tag(image_id, layer_id, layer_index, id_length=6):
169169 return f"img-{ short_image_id } -layer-{ layer_index :02} -{ short_layer_id } "
170170
171171
172- def create_codebase_resources (project , image ):
173- """Create the CodebaseResource for an `image` in a `project`."""
172+ def create_codebase_resources (project , image : Image ) -> None :
173+ """
174+ Create codebase resources for the provided image and its layers.
175+
176+ Creates a codebase resource for the extracted image root directory and each
177+ extracted layer directory, ensuring the structure is properly indexed for tree
178+ rendering.
179+
180+ Args:
181+ project: The project instance.
182+ image: The image object with the extracted_location attribute.
183+
184+ """
185+ pipes .make_codebase_resource (
186+ project = project ,
187+ location = str (project .codebase_path / Path (image .extracted_location ).name ),
188+ )
189+
174190 for layer_index , layer in enumerate (image .layers , start = 1 ):
175191 layer_tag = get_layer_tag (image .image_id , layer .layer_id , layer_index )
176192
@@ -182,6 +198,17 @@ def create_codebase_resources(project, image):
182198 tag = layer_tag ,
183199 )
184200
201+ layer_data = layer .to_dict ()
202+ layer_data .pop ("extracted_location" , None )
203+ layer_data .pop ("archive_location" , None )
204+ pipes .make_codebase_resource (
205+ project = project ,
206+ location = str (layer .extracted_location ),
207+ tag = layer_tag ,
208+ # Store the layer data in the extra_data for display in the UI
209+ extra_data = {"layer" : layer_data },
210+ )
211+
185212
186213def create_system_package (project , purl , package , layer , layer_tag ):
187214 """Create system package and related resources."""
0 commit comments