From 0624167487dcce0ff748d8737f2ac08015d8d635 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 8 Mar 2024 12:47:19 -0800 Subject: [PATCH] Rocky Linux installation support (#4398) * Update install.sh - Rocky Compatible Rocky Linux is the new Centos, I had tested these changes and it works as expected since it uses yum as a package manager. In addition, the metadata had no issues at all * add support for Rocky Linux 8 and 9 * fix for auto-instrumentation tests * correct GPG key location --------- Co-authored-by: bran1501 <61165159+bran1501@users.noreply.github.com> --- deployments/chef/kitchen.yml | 14 ++++++++ deployments/chef/metadata.rb | 5 +-- .../packaging/installer/install.sh | 8 ++--- .../tests/images/rpm/Dockerfile.rockylinux-8 | 22 +++++++++++++ .../tests/images/rpm/Dockerfile.rockylinux-9 | 22 +++++++++++++ .../tests/images/tar/Dockerfile.rockylinux-8 | 22 +++++++++++++ .../tests/images/tar/Dockerfile.rockylinux-9 | 22 +++++++++++++ .../packaging/tests/installer_test.py | 1 + .../images/rpm/Dockerfile.rockylinux-8 | 30 +++++++++++++++++ .../images/rpm/Dockerfile.rockylinux-9 | 33 +++++++++++++++++++ 10 files changed, 173 insertions(+), 6 deletions(-) create mode 100644 internal/buildscripts/packaging/tests/images/rpm/Dockerfile.rockylinux-8 create mode 100644 internal/buildscripts/packaging/tests/images/rpm/Dockerfile.rockylinux-9 create mode 100644 internal/buildscripts/packaging/tests/images/tar/Dockerfile.rockylinux-8 create mode 100644 internal/buildscripts/packaging/tests/images/tar/Dockerfile.rockylinux-9 create mode 100644 internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.rockylinux-8 create mode 100644 internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.rockylinux-9 diff --git a/deployments/chef/kitchen.yml b/deployments/chef/kitchen.yml index 6ecb6ddd61..c15cc91ece 100644 --- a/deployments/chef/kitchen.yml +++ b/deployments/chef/kitchen.yml @@ -46,6 +46,20 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro + - name: rockylinux-8 + driver: + image: dokken/rockylinux-8 + pid_one_command: /usr/lib/systemd/systemd + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + + - name: rockylinux-9 + driver: + image: dokken/rockylinux-9 + pid_one_command: /usr/lib/systemd/systemd + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + - name: debian-9 driver: image: dokken/debian-9 diff --git a/deployments/chef/metadata.rb b/deployments/chef/metadata.rb index 26fd221828..b008d0b9b0 100644 --- a/deployments/chef/metadata.rb +++ b/deployments/chef/metadata.rb @@ -8,9 +8,10 @@ supports 'amazon' supports 'centos' -supports 'redhat' -supports 'oracle' supports 'debian' +supports 'oracle' +supports 'redhat' +supports 'rockylinux' supports 'suse' supports 'ubuntu' supports 'windows' diff --git a/internal/buildscripts/packaging/installer/install.sh b/internal/buildscripts/packaging/installer/install.sh index 9e3cd25a4a..90a9e30445 100755 --- a/internal/buildscripts/packaging/installer/install.sh +++ b/internal/buildscripts/packaging/installer/install.sh @@ -553,7 +553,7 @@ install_node_package() { ubuntu|debian) apt-get install -y build-essential ;; - amzn|centos|ol|rhel) + amzn|centos|ol|rhel|rocky) if command -v yum >/dev/null 2>&1; then yum group install -y 'Development Tools' else @@ -676,7 +676,7 @@ install() { install_apt_package "splunk-otel-auto-instrumentation" "$instrumentation_version" fi ;; - amzn|centos|ol|rhel) + amzn|centos|ol|rhel|rocky) if [ -z "$distro_version" ]; then echo "The distribution version could not be determined" >&2 exit 1 @@ -754,7 +754,7 @@ uninstall() { exit 1 fi ;; - amzn|centos|ol|rhel|sles|opensuse*) + amzn|centos|ol|rhel|rocky|sles|opensuse*) if rpm -q $pkg >/dev/null 2>&1; then if [ "$pkg" != "splunk-otel-auto-instrumentation" ]; then systemctl stop $pkg || true @@ -966,7 +966,7 @@ distro_is_supported() { ;; esac ;; - centos|ol|rhel) + centos|ol|rhel|rocky) case "$distro_version" in 7*|8*|9*) return 0 diff --git a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.rockylinux-8 b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.rockylinux-8 new file mode 100644 index 0000000000..b2e4659346 --- /dev/null +++ b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.rockylinux-8 @@ -0,0 +1,22 @@ +# A rockylinux8 image with systemd enabled. Must be run with: +# `-d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro` flags +FROM quay.io/rockylinux/rockylinux:8 + +ENV container docker + +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial +RUN echo 'fastestmirror=1' >> /etc/yum.conf +RUN dnf install -y procps initscripts systemd wget + +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ + "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ + rm -f /lib/systemd/system/multi-user.target.wants/*;\ + rm -f /lib/systemd/system/local-fs.target.wants/*; \ + rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ + rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ + rm -f /lib/systemd/system/basic.target.wants/*;\ + rm -f /lib/systemd/system/anaconda.target.wants/*; + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/usr/sbin/init"] diff --git a/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.rockylinux-9 b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.rockylinux-9 new file mode 100644 index 0000000000..ffe41cf593 --- /dev/null +++ b/internal/buildscripts/packaging/tests/images/rpm/Dockerfile.rockylinux-9 @@ -0,0 +1,22 @@ +# A rockylinux9 image with systemd enabled. Must be run with: +# `-d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro` flags +FROM quay.io/rockylinux/rockylinux:9 + +ENV container docker + +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 +RUN echo 'fastestmirror=1' >> /etc/yum.conf +RUN dnf install -y procps initscripts systemd wget + +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ + "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ + rm -f /lib/systemd/system/multi-user.target.wants/*;\ + rm -f /lib/systemd/system/local-fs.target.wants/*; \ + rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ + rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ + rm -f /lib/systemd/system/basic.target.wants/*;\ + rm -f /lib/systemd/system/anaconda.target.wants/*; + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/usr/sbin/init"] diff --git a/internal/buildscripts/packaging/tests/images/tar/Dockerfile.rockylinux-8 b/internal/buildscripts/packaging/tests/images/tar/Dockerfile.rockylinux-8 new file mode 100644 index 0000000000..b2e4659346 --- /dev/null +++ b/internal/buildscripts/packaging/tests/images/tar/Dockerfile.rockylinux-8 @@ -0,0 +1,22 @@ +# A rockylinux8 image with systemd enabled. Must be run with: +# `-d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro` flags +FROM quay.io/rockylinux/rockylinux:8 + +ENV container docker + +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial +RUN echo 'fastestmirror=1' >> /etc/yum.conf +RUN dnf install -y procps initscripts systemd wget + +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ + "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ + rm -f /lib/systemd/system/multi-user.target.wants/*;\ + rm -f /lib/systemd/system/local-fs.target.wants/*; \ + rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ + rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ + rm -f /lib/systemd/system/basic.target.wants/*;\ + rm -f /lib/systemd/system/anaconda.target.wants/*; + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/usr/sbin/init"] diff --git a/internal/buildscripts/packaging/tests/images/tar/Dockerfile.rockylinux-9 b/internal/buildscripts/packaging/tests/images/tar/Dockerfile.rockylinux-9 new file mode 100644 index 0000000000..ffe41cf593 --- /dev/null +++ b/internal/buildscripts/packaging/tests/images/tar/Dockerfile.rockylinux-9 @@ -0,0 +1,22 @@ +# A rockylinux9 image with systemd enabled. Must be run with: +# `-d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro` flags +FROM quay.io/rockylinux/rockylinux:9 + +ENV container docker + +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 +RUN echo 'fastestmirror=1' >> /etc/yum.conf +RUN dnf install -y procps initscripts systemd wget + +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ + "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ + rm -f /lib/systemd/system/multi-user.target.wants/*;\ + rm -f /lib/systemd/system/local-fs.target.wants/*; \ + rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ + rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ + rm -f /lib/systemd/system/basic.target.wants/*;\ + rm -f /lib/systemd/system/anaconda.target.wants/*; + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/usr/sbin/init"] diff --git a/internal/buildscripts/packaging/tests/installer_test.py b/internal/buildscripts/packaging/tests/installer_test.py index 1ebc055f1a..a62caa0d73 100644 --- a/internal/buildscripts/packaging/tests/installer_test.py +++ b/internal/buildscripts/packaging/tests/installer_test.py @@ -475,6 +475,7 @@ def test_installer_with_instrumentation_default(distro, arch, method): @pytest.mark.parametrize("method", ["preload", "systemd"]) @pytest.mark.parametrize("sdk", ["java", "node"]) def test_installer_with_instrumentation_custom(distro, arch, method, sdk): + if distro == "opensuse-12" and arch == "arm64": pytest.skip("opensuse-12 arm64 no longer supported") diff --git a/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.rockylinux-8 b/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.rockylinux-8 new file mode 100644 index 0000000000..f3290175f2 --- /dev/null +++ b/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.rockylinux-8 @@ -0,0 +1,30 @@ +# A rockylinux8 image with systemd enabled. Must be run with: +# `-d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro` flags +FROM quay.io/rockylinux/rockylinux:8 + +ENV container docker + +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial +RUN echo 'fastestmirror=1' >> /etc/yum.conf +RUN dnf install -y procps initscripts systemd wget + +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ + "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ + rm -f /lib/systemd/system/multi-user.target.wants/*;\ + rm -f /lib/systemd/system/local-fs.target.wants/*; \ + rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ + rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ + rm -f /lib/systemd/system/basic.target.wants/*;\ + rm -f /lib/systemd/system/anaconda.target.wants/*; + +COPY --from=tomcat /usr/local/tomcat /usr/local/tomcat +COPY --from=tomcat /opt/java /opt/java +COPY instrumentation/setup-tomcat.sh /opt/ +RUN bash /opt/setup-tomcat.sh + +COPY instrumentation/setup-express.sh /opt +RUN bash /opt/setup-express.sh + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/usr/sbin/init"] diff --git a/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.rockylinux-9 b/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.rockylinux-9 new file mode 100644 index 0000000000..5010f2fd1a --- /dev/null +++ b/internal/buildscripts/packaging/tests/instrumentation/images/rpm/Dockerfile.rockylinux-9 @@ -0,0 +1,33 @@ +# A rockylinux9 image with systemd enabled. Must be run with: +# `-d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro` flags +FROM quay.io/rockylinux/rockylinux:9 + +ENV container docker + +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 +RUN echo 'fastestmirror=1' >> /etc/yum.conf +RUN dnf install -y procps initscripts systemd wget +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 +RUN echo 'fastestmirror=1' >> /etc/yum.conf +RUN dnf install -y procps initscripts systemd wget + +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i = \ + "systemd-tmpfiles-setup.service" ] || rm -f $i; done); \ + rm -f /lib/systemd/system/multi-user.target.wants/*;\ + rm -f /lib/systemd/system/local-fs.target.wants/*; \ + rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ + rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ + rm -f /lib/systemd/system/basic.target.wants/*;\ + rm -f /lib/systemd/system/anaconda.target.wants/*; + +COPY --from=tomcat /usr/local/tomcat /usr/local/tomcat +COPY --from=tomcat /opt/java /opt/java +COPY instrumentation/setup-tomcat.sh /opt/ +RUN bash /opt/setup-tomcat.sh + +COPY instrumentation/setup-express.sh /opt +RUN bash /opt/setup-express.sh + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/usr/sbin/init"]