From 4b657a2b5e967e4da7040d1ef087124cd9a5665f Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Fri, 6 Dec 2024 22:55:32 -0700 Subject: [PATCH] Remove systemd specific containers --- README.md | 8 --- containers.yml | 8 --- custom/testing/README.md | 8 --- custom/testing/entrypoint.py | 27 -------- .../golden-state-tree/os/rocky/pkgs/init.sls | 6 +- custom/testing/rescue.service | 30 --------- .../testing/systemd-amazonlinux-2.Dockerfile | 40 ------------ .../systemd-amazonlinux-2023.Dockerfile | 40 ------------ custom/testing/systemd-debian-11.Dockerfile | 46 ------------- custom/testing/systemd-debian-12.Dockerfile | 46 ------------- custom/testing/systemd-photon-5.Dockerfile | 44 ------------- .../testing/systemd-rockylinux-8.Dockerfile | 45 ------------- .../testing/systemd-rockylinux-9.Dockerfile | 45 ------------- .../testing/systemd-ubuntu-22.04.Dockerfile | 65 ------------------- custom/testing/tail | 45 ------------- 15 files changed, 4 insertions(+), 499 deletions(-) delete mode 100644 custom/testing/entrypoint.py delete mode 100644 custom/testing/rescue.service delete mode 100644 custom/testing/systemd-amazonlinux-2.Dockerfile delete mode 100644 custom/testing/systemd-amazonlinux-2023.Dockerfile delete mode 100644 custom/testing/systemd-debian-11.Dockerfile delete mode 100644 custom/testing/systemd-debian-12.Dockerfile delete mode 100644 custom/testing/systemd-photon-5.Dockerfile delete mode 100644 custom/testing/systemd-rockylinux-8.Dockerfile delete mode 100644 custom/testing/systemd-rockylinux-9.Dockerfile delete mode 100644 custom/testing/systemd-ubuntu-22.04.Dockerfile delete mode 100755 custom/testing/tail diff --git a/README.md b/README.md index 95e7a65..c25df56 100644 --- a/README.md +++ b/README.md @@ -110,14 +110,6 @@ will be commited. - testing:photon-5 - `ghcr.io/saltstack/salt-ci-containers/testing:photon-5` - testing:rockylinux-8 - `ghcr.io/saltstack/salt-ci-containers/testing:rockylinux-8` - testing:rockylinux-9 - `ghcr.io/saltstack/salt-ci-containers/testing:rockylinux-9` -- testing:systemd-amazonlinux-2 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-amazonlinux-2` -- testing:systemd-amazonlinux-2023 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-amazonlinux-2023` -- testing:systemd-debian-11 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-debian-11` -- testing:systemd-debian-12 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-debian-12` -- testing:systemd-photon-5 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-photon-5` -- testing:systemd-rockylinux-8 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-rockylinux-8` -- testing:systemd-rockylinux-9 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-rockylinux-9` -- testing:systemd-ubuntu-22.04 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-ubuntu-22.04` - testing:ubuntu-20.04 - `ghcr.io/saltstack/salt-ci-containers/testing:ubuntu-20.04` - testing:ubuntu-22.04 - `ghcr.io/saltstack/salt-ci-containers/testing:ubuntu-22.04` - testing:ubuntu-24.04 - `ghcr.io/saltstack/salt-ci-containers/testing:ubuntu-24.04` diff --git a/containers.yml b/containers.yml index 6af2224..77c1da5 100644 --- a/containers.yml +++ b/containers.yml @@ -48,24 +48,16 @@ custom: versions: - ubuntu-20.04 - ubuntu-22.04 - - systemd-ubuntu-22.04 - ubuntu-24.04 - rockylinux-8 - - systemd-rockylinux-8 - rockylinux-9 - - systemd-rockylinux-9 - photon-4 - photon-5 - - systemd-photon-5 - debian-11 - - systemd-debian-11 - debian-12 - - systemd-debian-12 - fedora-40 - amazonlinux-2 - - systemd-amazonlinux-2 - amazonlinux-2023 - - systemd-amazonlinux-2023 # <---- Custom Containers --------------------------------------------------------------------------------- diff --git a/custom/testing/README.md b/custom/testing/README.md index d796e04..29831a0 100644 --- a/custom/testing/README.md +++ b/custom/testing/README.md @@ -9,14 +9,6 @@ - testing:photon-5 - `ghcr.io/saltstack/salt-ci-containers/testing:photon-5` - testing:rockylinux-8 - `ghcr.io/saltstack/salt-ci-containers/testing:rockylinux-8` - testing:rockylinux-9 - `ghcr.io/saltstack/salt-ci-containers/testing:rockylinux-9` -- testing:systemd-amazonlinux-2 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-amazonlinux-2` -- testing:systemd-amazonlinux-2023 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-amazonlinux-2023` -- testing:systemd-debian-11 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-debian-11` -- testing:systemd-debian-12 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-debian-12` -- testing:systemd-photon-5 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-photon-5` -- testing:systemd-rockylinux-8 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-rockylinux-8` -- testing:systemd-rockylinux-9 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-rockylinux-9` -- testing:systemd-ubuntu-22.04 - `ghcr.io/saltstack/salt-ci-containers/testing:systemd-ubuntu-22.04` - testing:ubuntu-20.04 - `ghcr.io/saltstack/salt-ci-containers/testing:ubuntu-20.04` - testing:ubuntu-22.04 - `ghcr.io/saltstack/salt-ci-containers/testing:ubuntu-22.04` - testing:ubuntu-24.04 - `ghcr.io/saltstack/salt-ci-containers/testing:ubuntu-24.04` diff --git a/custom/testing/entrypoint.py b/custom/testing/entrypoint.py deleted file mode 100644 index d20c40b..0000000 --- a/custom/testing/entrypoint.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/env /usr/local/bin/python3 -""" -Systemd entrypoint hack. - -Writes /cmd.sh from the arguments passed to the script. Then execve systemd so -systemd will be process 1. The target rescue will execute /cmd.sh using /bin/sh. -This is needed so our ENTRYPOINT can be systemd with a target and CMD can be -customized at runtime as expected. -""" -from __future__ import annotations - -import os -import sys - -with open("/cmd.sh", "w") as fp: - fp.write(" ".join(sys.argv[1:])) -os.environ["PYTHONPATH"] = os.pathsep.join(sys.path) -cmd = "/usr/lib/systemd/systemd" -if os.execve in os.supports_fd: - with open(cmd, "rb") as fp: - sys.stdout.flush() - sys.stderr.flush() - args = ["--systemd", "--unit=rescue.target"] - os.execve(fp.fileno(), args, os.environ) -else: - args = [cmd, "--systemd", "--unit=rescue.target"] - os.execve(cmd, args, os.environ) diff --git a/custom/testing/golden-state-tree/os/rocky/pkgs/init.sls b/custom/testing/golden-state-tree/os/rocky/pkgs/init.sls index 6ce68e3..47ec55c 100644 --- a/custom/testing/golden-state-tree/os/rocky/pkgs/init.sls +++ b/custom/testing/golden-state-tree/os/rocky/pkgs/init.sls @@ -35,9 +35,11 @@ include: - pkgs.jq - pkgs.xz - pkgs.tree - - pkgs.cargo {#- + - pkgs.cargo + {#- - pkgs.awscli - - pkgs.amazon-cloudwatch-agent #} + - pkgs.amazon-cloudwatch-agent + - #} - pkgs.samba {#- OS Specific packages install #} diff --git a/custom/testing/rescue.service b/custom/testing/rescue.service deleted file mode 100644 index a16f798..0000000 --- a/custom/testing/rescue.service +++ /dev/null @@ -1,30 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Rescue Shell -Documentation=man:sulogin(8) -DefaultDependencies=no -Conflicts=shutdown.target -After=sysinit.target plymouth-start.service -Before=shutdown.target - -[Service] -Environment=HOME=/root -WorkingDirectory=-/root -ExecStart= -ExecStart=-/bin/sh /cmd.sh -ExecStartPost=/usr/bin/systemctl poweroff -Type=oneshot -StandardInput=tty-force -StandardOutput=inherit -StandardError=inherit -IgnoreSIGPIPE=no -RemainAfterExit=no -#SendSIGHUP=yes diff --git a/custom/testing/systemd-amazonlinux-2.Dockerfile b/custom/testing/systemd-amazonlinux-2.Dockerfile deleted file mode 100644 index 9240691..0000000 --- a/custom/testing/systemd-amazonlinux-2.Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -FROM amazonlinux:2 - -COPY golden-pillar-tree golden-pillar-tree -COPY golden-state-tree golden-state-tree - -SHELL ["/bin/bash", "-c"] - -RUN <> /etc/sysctl.conf - -# XXX: Override the rescue service. It would be better to not tamper with this -# and instead create our own service. That requires working out wants and such -# to make everything work correctly. -COPY rescue.service /etc/systemd/system/rescue.service.d/override.conf - - -# We've renamed /usr/bin/tail to /usr/bin/tail.real Now put our shim tail in -# place. This is needed because github actions always set the container's -# entrypoint to 'tail'. Our tail shim will launch systemd if it's pid is 1, -# essentially doing the same thing as entrypoint.py. When pid is not 1 we just -# run tail. -COPY tail /usr/bin/tail -COPY entrypoint.py /entrypoint.py -RUN chmod +x /usr/bin/tail /entrypoint.py - -ENTRYPOINT [ "/entrypoint.py" ] -CMD [ "/bin/bash" ] diff --git a/custom/testing/tail b/custom/testing/tail deleted file mode 100755 index 776c7ad..0000000 --- a/custom/testing/tail +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/env /usr/local/bin/python3 -""" -Systemd entrypoint hack. - -Writes /cmd.sh from the arguments passed to the script. Then execve systemd so -systemd will be process 1. The target rescue will execute /cmd.sh using /bin/sh. -This is needed so our ENTRYPOINT can be systemd with a target and CMD can be -customized at runtime as expected. -""" -from __future__ import annotations - -import os -import sys - - -def run_execve(cmd, args=None): - """ - Run the command with execve system call. - """ - if args is None: - args = [] - args = [cmd] + args - os.environ["PYTHONPATH"] = os.pathsep.join(sys.path) - if os.execve in os.supports_fd: - try: - with open(cmd, "rb") as fp: - os.execve(fp.fileno(), args, os.environ) - except FileNotFoundError: - print(f"Error: Command was {cmd}") - raise - else: - os.execve(cmd, args, os.environ) - - -pid = os.getpid() -if pid != 1: - cmd = "/usr/bin/tail.real" - run_execve(cmd, sys.argv[1:]) -else: - with open("/cmd.sh", "w") as fp: - if sys.argv[1:]: - fp.write(f"tail.real {' '.join(sys.argv[1:])}") - else: - fp.write("tail.real") - run_execve("/usr/lib/systemd/systemd", ["--systemd", "--unit=rescue.target"])