diff --git a/docker-jans-persistence-loader/Dockerfile b/docker-jans-persistence-loader/Dockerfile index 2702e9321c8..a5b1822d5d5 100644 --- a/docker-jans-persistence-loader/Dockerfile +++ b/docker-jans-persistence-loader/Dockerfile @@ -24,8 +24,9 @@ RUN python3 -m ensurepip \ # ===================== # janssenproject/jans SHA commit -ENV JANS_SOURCE_VERSION=8128244d16f212b9c687540ded6cb349abe4aafc +ENV JANS_SOURCE_VERSION=4fa83fcc3f298d91be3cb459bca52417aacd368e ARG JANS_SETUP_DIR=jans-linux-setup/jans_setup +ARG JANS_SCRIPT_CATALOG_DIR=docs/script-catalog # note that as we're pulling from a monorepo (with multiple project in it) # we are using partial-clone and sparse-checkout to get the jans-linux-setup code @@ -33,7 +34,8 @@ RUN git clone --filter blob:none --no-checkout https://github.com/janssenproject && cd /tmp/jans \ && git sparse-checkout init --cone \ && git checkout ${JANS_SOURCE_VERSION} \ - && git sparse-checkout set ${JANS_SETUP_DIR} + && git sparse-checkout add ${JANS_SETUP_DIR} \ + && git sparse-checkout add ${JANS_SCRIPT_CATALOG_DIR} RUN mkdir -p /app/static /app/static/couchbase /app/schema /app/openbanking/static /app/static/opendj @@ -46,7 +48,8 @@ RUN cd /tmp/jans \ && cp -R ${JANS_SETUP_DIR}/static/rdbm /app/static/rdbm \ && cp ${JANS_SETUP_DIR}/schema/jans_schema.json /app/schema/jans_schema.json \ && cp ${JANS_SETUP_DIR}/schema/custom_schema.json /app/schema/custom_schema.json \ - && cp ${JANS_SETUP_DIR}/static/opendj/index.json /app/static/opendj/index.json + && cp ${JANS_SETUP_DIR}/static/opendj/index.json /app/static/opendj/index.json \ + && cp -R ${JANS_SCRIPT_CATALOG_DIR} /app/script-catalog RUN mkdir -p /app/templates/jans-config-api diff --git a/docker-jans-persistence-loader/scripts/utils.py b/docker-jans-persistence-loader/scripts/utils.py index 062e4a98ac5..23e2e4f8f64 100644 --- a/docker-jans-persistence-loader/scripts/utils.py +++ b/docker-jans-persistence-loader/scripts/utils.py @@ -156,20 +156,21 @@ def merge_extension_ctx(ctx: dict[str, _t.Any]) -> dict[str, _t.Any]: :param ctx: A key-value pairs of existing contexts. :returns: Merged contexts. """ - basedir = "/app/static/extension" - if os.environ.get("CN_DISTRIBUTION", "default") == "openbanking": - basedir = "/app/openbanking/static/extension" + basedirs = ["/app/openbanking/static/extension"] + else: + basedirs = ["/app/static/extension", "/app/script-catalog"] - filepath = Path(basedir) - for ext_path in filepath.glob("**/*"): - if not ext_path.is_file() or ext_path.suffix.lower() not in (".py", ".java"): - continue + for basedir in basedirs: + filepath = Path(basedir) + for ext_path in filepath.glob("**/*"): + if not ext_path.is_file() or ext_path.suffix.lower() not in (".py", ".java"): + continue - ext_type = ext_path.relative_to(filepath).parent.as_posix().lower().replace(os.path.sep, "_") - ext_name = ext_path.stem.lower() - script_name = f"{ext_type}_{ext_name}" - ctx[script_name] = generate_base64_contents(ext_path.read_text()) + ext_type = ext_path.relative_to(filepath).parent.as_posix().lower().replace(os.path.sep, "_").replace("-", "_") + ext_name = ext_path.stem.lower() + script_name = f"{ext_type}_{ext_name}" + ctx[script_name] = generate_base64_contents(ext_path.read_text()) return ctx