From fbb502606dbdae2f8fe6ea05eaf18b5fa48790f6 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Fri, 19 Jul 2024 10:53:58 +0200 Subject: [PATCH] Install some extra python packages It seems like python-nginx was needed by the operator. Fixes #653 --- CHANGES/653.bugfix | 1 + images/assets/requirements.extra.txt | 2 ++ images/assets/requirements.minimal.txt | 1 + images/assets/route_paths.py | 33 ++++++++++++------- .../pulp-minimal/nightly/Containerfile.core | 10 +++--- images/pulp-minimal/stable/Containerfile.core | 6 +++- images/pulp/nightly/Containerfile | 6 ++-- images/pulp/stable/Containerfile | 5 +-- 8 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 CHANGES/653.bugfix create mode 100644 images/assets/requirements.extra.txt create mode 100644 images/assets/requirements.minimal.txt diff --git a/CHANGES/653.bugfix b/CHANGES/653.bugfix new file mode 100644 index 00000000..58aaf02e --- /dev/null +++ b/CHANGES/653.bugfix @@ -0,0 +1 @@ +Install python-nginx on pulp-minimal. diff --git a/images/assets/requirements.extra.txt b/images/assets/requirements.extra.txt new file mode 100644 index 00000000..89bc1830 --- /dev/null +++ b/images/assets/requirements.extra.txt @@ -0,0 +1,2 @@ +rhsm +django-auth-ldap diff --git a/images/assets/requirements.minimal.txt b/images/assets/requirements.minimal.txt new file mode 100644 index 00000000..1fdfbe67 --- /dev/null +++ b/images/assets/requirements.minimal.txt @@ -0,0 +1 @@ +python-nginx # needed by route-paths.py diff --git a/images/assets/route_paths.py b/images/assets/route_paths.py index dd754836..e5277035 100755 --- a/images/assets/route_paths.py +++ b/images/assets/route_paths.py @@ -4,15 +4,18 @@ import json import re import sys -import nginx from pathlib import Path +import nginx + nginx_configs = [] for i in pkgutil.iter_modules(): # filter pulp and galaxy packages - if re.search(r'pulp_.*|galaxy_ng',i.name): - snippet_file = i.module_finder.path + "/" + i.name + "/app/webserver_snippets/nginx.conf" + if re.search(r"pulp_.*|galaxy_ng", i.name): + snippet_file = ( + i.module_finder.path + "/" + i.name + "/app/webserver_snippets/nginx.conf" + ) # only add the filename to array if it exists if Path(snippet_file).is_file(): nginx_configs.append(snippet_file) @@ -21,7 +24,11 @@ router = [] for plugin_conf in nginx_configs: - app = "galaxy" if "galaxy" in plugin_conf else plugin_conf.split("pulp_")[1].split("/")[0] + app = ( + "galaxy" + if "galaxy" in plugin_conf + else plugin_conf.split("pulp_")[1].split("/")[0] + ) conf = nginx.loadf(plugin_conf) for location in conf.filter("Location"): path = location.value @@ -47,20 +54,22 @@ raise RuntimeError(f"Location {path} doesn't have proxy_pass") new_path = { - "name":f"{name}-{app}{path.rstrip('/').replace('/', '-').replace('_', '-')}", + "name": f"{name}-{app}{path.rstrip('/').replace('/', '-').replace('_', '-')}", "path": path, "targetPort": target_port, "serviceName": svc_name, } if rewrite: new_path["rewrite"] = rewrite - router.append({ - "name":f"{name}-{app}{path.rstrip('/').replace('/', '-').replace('_', '-')}2", - "path": path.rstrip("/"), - "targetPort": target_port, - "serviceName": svc_name, - "rewrite": rewrite, - }) + router.append( + { + "name": f"{name}-{app}{path.rstrip('/').replace('/', '-').replace('_', '-')}2", + "path": path.rstrip("/"), + "targetPort": target_port, + "serviceName": svc_name, + "rewrite": rewrite, + } + ) router.append(new_path) diff --git a/images/pulp-minimal/nightly/Containerfile.core b/images/pulp-minimal/nightly/Containerfile.core index d19c6759..dc37e063 100644 --- a/images/pulp-minimal/nightly/Containerfile.core +++ b/images/pulp-minimal/nightly/Containerfile.core @@ -1,19 +1,21 @@ ARG FROM_TAG="latest" FROM pulp/base:${FROM_TAG} +COPY assets/requirements.extra.txt . +COPY assets/requirements.minimal.txt . + RUN pip3 install \ - pulpcore[s3,google,azure]@git+https://github.com/pulp/pulpcore.git#egg=pulpcore \ + pulpcore[s3,google,azure]@git+https://github.com/pulp/pulpcore.git \ git+https://github.com/pulp/pulp_ansible.git \ - git+https://github.com/pulp/pulp-certguard.git \ git+https://github.com/pulp/pulp_container.git \ git+https://github.com/pulp/pulp_deb.git \ - git+https://github.com/pulp/pulp_file.git \ git+https://github.com/pulp/pulp_gem.git \ git+https://github.com/pulp/pulp_maven.git \ git+https://github.com/pulp/pulp_ostree.git \ git+https://github.com/pulp/pulp_python.git \ git+https://github.com/pulp/pulp_rpm.git \ - rhsm \ + -r requirements.extra.txt + -r requirements.minimal.txt -c /constraints.txt && \ rm -rf /root/.cache/pip diff --git a/images/pulp-minimal/stable/Containerfile.core b/images/pulp-minimal/stable/Containerfile.core index f7e7b34b..9cc8f947 100644 --- a/images/pulp-minimal/stable/Containerfile.core +++ b/images/pulp-minimal/stable/Containerfile.core @@ -12,6 +12,9 @@ ARG PULP_PYTHON_VERSION="" ARG PULP_RPM_VERSION="" ARG PULP_OSTREE_VERSION="" +COPY assets/requirements.extra.txt . +COPY assets/requirements.minimal.txt . + RUN pip3 install --upgrade \ pulpcore[s3,google,azure]${PULPCORE_VERSION} \ pulp-ansible${PULP_ANSIBLE_VERSION} \ @@ -23,7 +26,8 @@ RUN pip3 install --upgrade \ pulp-python${PULP_PYTHON_VERSION} \ pulp-rpm${PULP_RPM_VERSION} \ pulp-ostree${PULP_OSTREE_VERSION} \ - rhsm \ + -r requirements.extra.txt + -r requirements.minimal.txt -c /constraints.txt && \ rm -rf /root/.cache/pip diff --git a/images/pulp/nightly/Containerfile b/images/pulp/nightly/Containerfile index 89b76c1d..cf9924eb 100644 --- a/images/pulp/nightly/Containerfile +++ b/images/pulp/nightly/Containerfile @@ -1,19 +1,19 @@ ARG FROM_TAG="latest" FROM pulp/pulp-ci-centos9:${FROM_TAG} +COPY assets/requirements.extra.txt . + RUN pip3 install --upgrade \ pulpcore[s3,google,azure]@git+https://github.com/pulp/pulpcore@main \ git+https://github.com/pulp/pulp_ansible@main \ - git+https://github.com/pulp/pulp-certguard@main \ git+https://github.com/pulp/pulp_container@main \ git+https://github.com/pulp/pulp_deb@main \ - git+https://github.com/pulp/pulp_file@main \ git+https://github.com/pulp/pulp_gem@main \ git+https://github.com/pulp/pulp_maven@main \ git+https://github.com/pulp/pulp_ostree@main \ git+https://github.com/pulp/pulp_python@main \ git+https://github.com/pulp/pulp_rpm@main \ - rhsm \ + -r requirements.extra.txt -c /constraints.txt && \ rm -rf /root/.cache/pip diff --git a/images/pulp/stable/Containerfile b/images/pulp/stable/Containerfile index dc53dbbd..fe2cc7b6 100644 --- a/images/pulp/stable/Containerfile +++ b/images/pulp/stable/Containerfile @@ -13,6 +13,8 @@ ARG PULP_PYTHON_VERSION="" ARG PULP_RPM_VERSION="" ARG PULP_OSTREE_VERSION="" +COPY assets/requirements.extra.txt . + RUN pip3 install --upgrade \ pulpcore[s3,google,azure]${PULPCORE_VERSION} \ pulp-ansible${PULP_ANSIBLE_VERSION} \ @@ -25,8 +27,7 @@ RUN pip3 install --upgrade \ pulp-python${PULP_PYTHON_VERSION} \ pulp-rpm${PULP_RPM_VERSION} \ pulp-ostree${PULP_OSTREE_VERSION} \ - rhsm \ - requests \ + -r requirements.extra.txt -c /constraints.txt && \ rm -rf /root/.cache/pip