Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .rhdh/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,6 @@ COPY --from=build --chown=1001:1001 "$CONTAINER_SOURCE"/ ./
# RHIDP-4220 - make Konflux preflight and EC checks happy - [check-container] Create a directory named /licenses and include all relevant licensing
COPY $EXTERNAL_SOURCE_NESTED/LICENSE /licenses/

# RHIDP-5216/RHIDP-5215 - interim marketplace catalog entities until these data will be loaded from container images
COPY $EXTERNAL_SOURCE_NESTED/catalog-entities/marketplace /marketplace/catalog-entities/

# Copy script to gather dynamic plugins; copy embedded dynamic plugins to root folder; fix permissions
COPY $EXTERNAL_SOURCE_NESTED/docker/install-dynamic-plugins.py $EXTERNAL_SOURCE_NESTED/docker/install-dynamic-plugins.sh ./
RUN chmod -R a+rx ./install-dynamic-plugins.*
Expand Down
3 changes: 0 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ COPY --from=build --chown=1001:1001 $CONTAINER_SOURCE/dynamic-plugins/dist/ ./dy
# RHIDP-4220 - make Konflux preflight and EC checks happy - [check-container] Create a directory named /licenses and include all relevant licensing
COPY $EXTERNAL_SOURCE_NESTED/LICENSE /licenses/

# RHIDP-5216/RHIDP-5215 - interim marketplace catalog entities until these data will be loaded from container images
COPY $EXTERNAL_SOURCE_NESTED/catalog-entities/marketplace /marketplace/catalog-entities/

# Copy script to gather dynamic plugins; copy embedded dynamic plugins to root folder; fix permissions
COPY docker/install-dynamic-plugins.py docker/install-dynamic-plugins.sh ./
RUN chmod -R a+rx ./install-dynamic-plugins.*
Expand Down
29 changes: 26 additions & 3 deletions docker/install-dynamic-plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,10 @@ def _extract_layer_tarball(layer_file: str, catalog_index_temp_dir: str, max_ent
continue
tar.extract(member, path=catalog_index_temp_dir, filter='data')

def extract_catalog_index(catalog_index_image: str, catalog_index_mount: str) -> str:
def extract_catalog_index(catalog_index_image: str, catalog_index_mount: str, catalog_entities_parent_dir: str) -> str:
"""Extract the catalog index OCI image and return the path to dynamic-plugins.default.yaml if found."""
print(f"\n======= Extracting catalog index from {catalog_index_image}", flush=True)

skopeo_path = shutil.which('skopeo')
if skopeo_path is None:
raise InstallException("CATALOG_INDEX_IMAGE is set but skopeo executable not found in PATH. Cannot extract catalog index.")
Expand Down Expand Up @@ -998,7 +999,27 @@ def extract_catalog_index(catalog_index_image: str, catalog_index_mount: str) ->
default_plugins_file = os.path.join(catalog_index_temp_dir, 'dynamic-plugins.default.yaml')
if not os.path.isfile(default_plugins_file):
raise InstallException(f"Catalog index image {catalog_index_image} does not contain the expected dynamic-plugins.default.yaml file")
print("\t==> Successfully extracted catalog index with dynamic-plugins.default.yaml", flush=True)
print("\t==> Successfully extracted dynamic-plugins.default.yaml from catalog index image", flush=True)

print(f"\t==> Extracting extensions catalog entities to {catalog_entities_parent_dir}", flush=True)

extensions_dir_from_catalog_index = os.path.join(catalog_index_temp_dir, 'catalog-entities', 'extensions')
if not os.path.isdir(extensions_dir_from_catalog_index):
# fallback to 'catalog-entities/marketplace' directory for backward compatibility
extensions_dir_from_catalog_index = os.path.join(catalog_index_temp_dir, 'catalog-entities', 'marketplace')

if os.path.isdir(extensions_dir_from_catalog_index):
os.makedirs(catalog_entities_parent_dir, exist_ok=True)
catalog_entities_dest = os.path.join(catalog_entities_parent_dir, 'catalog-entities')
# Ensure the destination directory is is sync with the catalog entities from the index image
if os.path.exists(catalog_entities_dest):
shutil.rmtree(catalog_entities_dest, ignore_errors=True, onerror=None)
shutil.copytree(extensions_dir_from_catalog_index, catalog_entities_dest, dirs_exist_ok=True)
print("\t==> Successfully extracted extensions catalog entities from index image", flush=True)
else:
print(f"\t==> WARNING: Catalog index image {catalog_index_image} does not have neither 'catalog-entities/extensions/' nor 'catalog-entities/marketplace/' directory",
flush=True)

return default_plugins_file

def main():
Expand All @@ -1015,7 +1036,9 @@ def main():
catalog_index_image = os.environ.get("CATALOG_INDEX_IMAGE", "")
catalog_index_default_file = None
if catalog_index_image:
catalog_index_default_file = extract_catalog_index(catalog_index_image, dynamic_plugins_root)
# default to <dynamic-plugins-root>/extensions if the env var is not set, to make it easier to run locally.
catalog_entities_parent_dir = os.environ.get("CATALOG_ENTITIES_EXTRACT_DIR", os.path.join(dynamic_plugins_root, "extensions"))
catalog_index_default_file = extract_catalog_index(catalog_index_image, dynamic_plugins_root, catalog_entities_parent_dir)

skip_integrity_check = os.environ.get("SKIP_INTEGRITY_CHECK", "").lower() == "true"

Expand Down
Loading
Loading