From e6e5088a7f824beff0a75ca15132af9b35c552e3 Mon Sep 17 00:00:00 2001 From: james hughes Date: Wed, 25 Sep 2024 00:09:49 +0000 Subject: [PATCH 1/7] [chore] Add procps to opensuse-15 images in attempt to fix missing pgrep --- .../tests/deployments/puppet/images/rpm/Dockerfile.opensuse-15 | 2 +- .../tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 | 2 +- .../packaging/tests/images/rpm/Dockerfile.opensuse-15 | 2 +- .../tests/instrumentation/images/rpm/Dockerfile.opensuse-15 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/buildscripts/packaging/tests/deployments/puppet/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/deployments/puppet/images/rpm/Dockerfile.opensuse-15 index a18426a590..efd7e59c5a 100644 --- a/internal/buildscripts/packaging/tests/deployments/puppet/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/deployments/puppet/images/rpm/Dockerfile.opensuse-15 @@ -5,7 +5,7 @@ FROM opensuse/leap:15 ENV container docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo -RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget gzip +RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget gzip procps RUN rpm --import https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406 diff --git a/internal/buildscripts/packaging/tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 index 452fc94a35..dd0d77dce3 100644 --- a/internal/buildscripts/packaging/tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 @@ -3,7 +3,7 @@ FROM opensuse/leap:15 ENV container docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo -RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget python3-pip ca-certificates gzip +RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget python3-pip ca-certificates gzip procps RUN zypper install -y salt salt-minion salt-master diff --git a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 index cdeaa32fda..7d6ed1d132 100644 --- a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 @@ -5,7 +5,7 @@ FROM opensuse/leap:15 ENV container docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo -RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget +RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget procps RUN (cd /usr/lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ diff --git a/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.opensuse-15 index 121c00baf5..51610d735e 100644 --- a/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.opensuse-15 @@ -9,7 +9,7 @@ ARG TARGETARCH ENV container docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo -RUN zypper -n install -l curl dbus-1 gzip python3 systemd-sysvinit tar wget +RUN zypper -n install -l curl dbus-1 gzip python3 systemd-sysvinit tar wget procps RUN (cd /usr/lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ From d9d96ff17e2d234c75b637979982ecfe0d9ad292 Mon Sep 17 00:00:00 2001 From: james hughes Date: Wed, 25 Sep 2024 01:46:12 +0000 Subject: [PATCH 2/7] fix line where it happens --- .../deployments/puppet/images/rpm/Dockerfile.opensuse-15 | 4 ++-- .../tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 | 4 ++-- .../packaging/tests/images/rpm/Dockerfile.opensuse-15 | 3 ++- .../tests/instrumentation/images/rpm/Dockerfile.opensuse-15 | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/buildscripts/packaging/tests/deployments/puppet/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/deployments/puppet/images/rpm/Dockerfile.opensuse-15 index efd7e59c5a..a30d22289d 100644 --- a/internal/buildscripts/packaging/tests/deployments/puppet/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/deployments/puppet/images/rpm/Dockerfile.opensuse-15 @@ -5,14 +5,14 @@ FROM opensuse/leap:15 ENV container docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo -RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget gzip procps +RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget gzip RUN rpm --import https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406 ARG PUPPET_RELEASE="6" RUN rpm -Uvh https://yum.puppet.com/puppet${PUPPET_RELEASE}-release-sles-15.noarch.rpm && \ zypper --gpg-auto-import-keys -n refresh && \ - zypper install -y puppet-agent + zypper install -y puppet-agent procps RUN wget -O /tmp/nodejs.tar.gz https://nodejs.org/dist/v16.20.2/node-v16.20.2-linux-x64.tar.gz && \ mkdir -p /opt/ && \ diff --git a/internal/buildscripts/packaging/tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 index dd0d77dce3..6bbbb0869b 100644 --- a/internal/buildscripts/packaging/tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/deployments/salt/images/rpm/Dockerfile.opensuse-15 @@ -3,9 +3,9 @@ FROM opensuse/leap:15 ENV container docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo -RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget python3-pip ca-certificates gzip procps +RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget python3-pip ca-certificates gzip -RUN zypper install -y salt salt-minion salt-master +RUN zypper install -y salt salt-minion salt-master procps RUN wget -O /tmp/nodejs.tar.gz https://nodejs.org/dist/v16.20.2/node-v16.20.2-linux-x64.tar.gz && \ mkdir -p /opt/ && \ diff --git a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 index 7d6ed1d132..532998dc69 100644 --- a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 @@ -5,7 +5,8 @@ FROM opensuse/leap:15 ENV container docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo -RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget procps +RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget +RUN zypper install -y procps RUN (cd /usr/lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ diff --git a/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.opensuse-15 index 51610d735e..22742d5167 100644 --- a/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.opensuse-15 @@ -9,7 +9,7 @@ ARG TARGETARCH ENV container docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo -RUN zypper -n install -l curl dbus-1 gzip python3 systemd-sysvinit tar wget procps +RUN zypper -n install -l curl dbus-1 gzip python3 systemd-sysvinit tar wget RUN (cd /usr/lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ @@ -30,7 +30,7 @@ RUN bash /opt/setup-express.sh COPY instrumentation/setup-dotnet.sh /opt RUN if [ "$TARGETARCH" = "amd64" ]; then \ - zypper -n install libicu && \ + zypper -n install libicu procps && \ bash /opt/setup-dotnet.sh; \ fi From 26297685fda2b162613e9bb038bcce367f502c96 Mon Sep 17 00:00:00 2001 From: james hughes Date: Wed, 25 Sep 2024 06:01:22 +0000 Subject: [PATCH 3/7] excercise pgrep which keeps claiming not to exist later on --- .../packaging/tests/images/rpm/Dockerfile.opensuse-15 | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 index 532998dc69..e79a7d1cd4 100644 --- a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 @@ -7,6 +7,7 @@ ENV container docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget RUN zypper install -y procps +RUN pgrep --help RUN (cd /usr/lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ From 01f3a927bef830cb66971d2ac92a032b16abf8b3 Mon Sep 17 00:00:00 2001 From: james hughes Date: Wed, 25 Sep 2024 06:39:05 +0000 Subject: [PATCH 4/7] Try using exact path --- internal/buildscripts/packaging/tests/helpers/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/buildscripts/packaging/tests/helpers/util.py b/internal/buildscripts/packaging/tests/helpers/util.py index 1ca5e6c254..6f7f6ae29b 100644 --- a/internal/buildscripts/packaging/tests/helpers/util.py +++ b/internal/buildscripts/packaging/tests/helpers/util.py @@ -181,7 +181,7 @@ def ensure_always(test, timeout=DEFAULT_TIMEOUT, interval=1): def service_is_running(container, service_name=SERVICE_NAME, service_owner=SERVICE_OWNER, process=OTELCOL_BIN): - cmd = f"sh -ec 'systemctl status {service_name} && pgrep -a -u {service_owner} -f {process}'" + cmd = f"sh -ec 'systemctl status {service_name} && /bin/pgrep -a -u {service_owner} -f {process}'" code, _ = run_container_cmd(container, cmd, exit_code=None) return code == 0 From 9a3bb6c5135e80a161b88185431f2448fe4ff47c Mon Sep 17 00:00:00 2001 From: james hughes Date: Wed, 25 Sep 2024 06:54:06 +0000 Subject: [PATCH 5/7] Also set path --- internal/buildscripts/packaging/tests/helpers/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/buildscripts/packaging/tests/helpers/util.py b/internal/buildscripts/packaging/tests/helpers/util.py index 6f7f6ae29b..46bdd7a8dc 100644 --- a/internal/buildscripts/packaging/tests/helpers/util.py +++ b/internal/buildscripts/packaging/tests/helpers/util.py @@ -19,6 +19,7 @@ from contextlib import contextmanager from io import BytesIO from pathlib import Path +from typing import Optional, Tuple import docker @@ -121,7 +122,7 @@ def run_distro_container(distro, arch="amd64", dockerfile=None, path=TESTS_DIR, container.remove(force=True, v=True) -def run_container_cmd(container, cmd, env=None, exit_code=0, timeout=None, user='', workdir=None): +def run_container_cmd(container, cmd, env=None, exit_code:Optional[int]=0, timeout=None, user='', workdir=None) -> Tuple[int, bytes]: if timeout: cmd = f"timeout {timeout} {cmd}" print(f"Running '{cmd}' ...") @@ -181,7 +182,7 @@ def ensure_always(test, timeout=DEFAULT_TIMEOUT, interval=1): def service_is_running(container, service_name=SERVICE_NAME, service_owner=SERVICE_OWNER, process=OTELCOL_BIN): - cmd = f"sh -ec 'systemctl status {service_name} && /bin/pgrep -a -u {service_owner} -f {process}'" + cmd = f"""sh -ec 'systemctl status {service_name} && PATH="$PATH:/bin/" pgrep -a -u {service_owner} -f {process}'""" code, _ = run_container_cmd(container, cmd, exit_code=None) return code == 0 From 752a9a185b166ed266fd64b654858516d06dc653 Mon Sep 17 00:00:00 2001 From: james hughes Date: Wed, 25 Sep 2024 07:15:50 +0000 Subject: [PATCH 6/7] Comment why we're setting PATH --- internal/buildscripts/packaging/tests/helpers/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/buildscripts/packaging/tests/helpers/util.py b/internal/buildscripts/packaging/tests/helpers/util.py index 46bdd7a8dc..f57566e520 100644 --- a/internal/buildscripts/packaging/tests/helpers/util.py +++ b/internal/buildscripts/packaging/tests/helpers/util.py @@ -182,6 +182,7 @@ def ensure_always(test, timeout=DEFAULT_TIMEOUT, interval=1): def service_is_running(container, service_name=SERVICE_NAME, service_owner=SERVICE_OWNER, process=OTELCOL_BIN): + # For some reason, opensuse-15 and sometimes rocky-8 don't set the path correctly? cmd = f"""sh -ec 'systemctl status {service_name} && PATH="$PATH:/bin/" pgrep -a -u {service_owner} -f {process}'""" code, _ = run_container_cmd(container, cmd, exit_code=None) return code == 0 From 0cd2304519ef100e844e8e679cab1d27a63ca117 Mon Sep 17 00:00:00 2001 From: james hughes Date: Wed, 25 Sep 2024 07:16:54 +0000 Subject: [PATCH 7/7] Try setting PATH in dockerfile for opensuse-15, also boyscout principle --- .../packaging/tests/images/rpm/Dockerfile.opensuse-15 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 index e79a7d1cd4..b0ae43b987 100644 --- a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 +++ b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.opensuse-15 @@ -2,12 +2,13 @@ # `-d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro` flags FROM opensuse/leap:15 -ENV container docker +ENV container=docker RUN sed -i 's|download.opensuse.org|provo-mirror.opensuse.org|' /etc/zypp/repos.d/*.repo RUN zypper -n install -l curl dbus-1 systemd-sysvinit tar wget RUN zypper install -y procps RUN pgrep --help +RUN echo "PATH=$PATH:/bin" >> /etc/profile RUN (cd /usr/lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \