From bc3ae7509126dcf86ab74db7d7b107add3acf9c6 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Thu, 30 Apr 2020 17:53:40 +0100 Subject: [PATCH] Enforce running Podman over Docker Running a full systemd including gettys inside a privileged container has nasty side effects such as the container getty starting to write to the same tty as the system getty. Always run Podman since it can run rootless and doesn't suffer from these drawbacks. --- ci/run-functional.sh | 5 +++++ tests/functional/test_deploy.py | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ci/run-functional.sh b/ci/run-functional.sh index 77fac80c7..e496bfd78 100755 --- a/ci/run-functional.sh +++ b/ci/run-functional.sh @@ -2,6 +2,11 @@ #!nix-shell ../shell.nix -i bash set -eu +# Check if we're in github actions +echo "Github Workflow: "$GITHUB_WORKFLOW + +sudo ln -s $(which docker) $(dirname $(which docker)/podman) + # We rely on commits not in 20.03 for container testing export NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz diff --git a/tests/functional/test_deploy.py b/tests/functional/test_deploy.py index 94b8cb9d2..9b91f1955 100644 --- a/tests/functional/test_deploy.py +++ b/tests/functional/test_deploy.py @@ -34,7 +34,7 @@ def get_container_image() -> str: ) image_id = ( - subprocess.check_output(["docker", "images", "-q", image_name]).decode().strip() + subprocess.check_output(["podman", "images", "-q", image_name]).decode().strip() ) if image_id: return image_id @@ -59,7 +59,7 @@ def get_container_image() -> str: )[0] return ( - subprocess.check_output(["docker", "import", image_file, image_name]) + subprocess.check_output(["podman", "import", image_file, image_name]) .decode() .strip() ) @@ -91,7 +91,7 @@ def started(self) -> bool: def run(self): process = subprocess.run( [ - "docker", + "podman", "run", "--privileged", f"--publish={self.ssh_port}:22", @@ -134,13 +134,13 @@ def wait_for_ssh(self, timeout=60): def stop(self): if not self.container_id: return - subprocess.run(["docker", "kill", self.container_id]) + subprocess.run(["podman", "kill", self.container_id]) def destroy(self): if not self.container_id: return self.stop() - subprocess.run(["docker", "rm", "-f", self.container_id]) + subprocess.run(["podman", "rm", "-f", self.container_id]) class Deployment: