From b9027a133a5b50e8f628cd6baea7f0d1c61dd111 Mon Sep 17 00:00:00 2001 From: Marco Fargetta Date: Wed, 18 Dec 2024 12:13:55 +0100 Subject: [PATCH] Test podman sigterm on tps --- .github/workflows/tps-container-test.yml | 6 ++++-- base/tps/bin/pki-tps-run | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tps-container-test.yml b/.github/workflows/tps-container-test.yml index 6a5ff8f4791..8202f196c98 100644 --- a/.github/workflows/tps-container-test.yml +++ b/.github/workflows/tps-container-test.yml @@ -415,7 +415,8 @@ jobs: - name: Restart CA run: | docker restart ca - sleep 5 + sleep 10 + docker network reload --all # wait for CA to restart docker exec client curl \ @@ -785,7 +786,8 @@ jobs: - name: Restart TPS run: | docker restart tps - sleep 5 + sleep 10 + docker network reload --all # wait for TPS to restart docker exec client curl \ diff --git a/base/tps/bin/pki-tps-run b/base/tps/bin/pki-tps-run index dcbc2976a63..87d4f848a9b 100644 --- a/base/tps/bin/pki-tps-run +++ b/base/tps/bin/pki-tps-run @@ -168,15 +168,21 @@ find /logs -type d -exec chmod +rwx -- {} + echo "################################################################################" echo "INFO: Starting TPS server" +trap "kill -- -$(ps -o pgid= $PID | grep -o '[0-9]*')" TERM + if [ "$UID" = "0" ]; then # In Docker the server runs as root user but it will switch # into pkiuser (UID=17) that belongs to the root group (GID=0). - pki-server run + pki-server run & + PID=$! + wait $PID else # In OpenShift/Podman the server runs as a non-root user # (with a random UID) that belongs to the root group (GID=0). # # https://www.redhat.com/en/blog/jupyter-on-openshift-part-6-running-as-an-assigned-user-id - pki-server run --as-current-user + pki-server run --as-current-user & + PID=$! + wait $PID fi