From a17cd577e0e420745768e3c0529e6778fc84dfa9 Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Mon, 26 Feb 2024 16:48:22 +0000 Subject: [PATCH] Add script and service template Signed-off-by: Gabriel Adrian Samfira --- test/integration/config/garm.service | 13 ++++++++++++ test/integration/scripts/taredown_garm.sh | 24 +++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 test/integration/config/garm.service create mode 100755 test/integration/scripts/taredown_garm.sh diff --git a/test/integration/config/garm.service b/test/integration/config/garm.service new file mode 100644 index 00000000..92b1d279 --- /dev/null +++ b/test/integration/config/garm.service @@ -0,0 +1,13 @@ +[Unit] +Description=GitHub Actions Runner Manager (garm) +After=multi-user.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/garm -config ${GARM_CONFIG_FILE} +ExecReload=/bin/kill -HUP $MAINPID +Restart=always +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/test/integration/scripts/taredown_garm.sh b/test/integration/scripts/taredown_garm.sh new file mode 100755 index 00000000..7f080324 --- /dev/null +++ b/test/integration/scripts/taredown_garm.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +if [ -f "$GITHUB_ENV" ];then + source $GITHUB_ENV +fi + +if [ -z $GARM_CONFIG_DIR ]; then + echo "ERROR: GARM_CONFIG_DIR is not set" + exit 1 +fi + +if [ -z $GARM_SERVICE_NAME ]; then + echo "ERROR: GARM_SERVICE_NAME is not set" + exit 1 +fi + +if [ -f "$HOME/.local/share/systemd/user/${GARM_SERVICE_NAME}.service" ];then + systemctl --user stop $GARM_SERVICE_NAME.service + rm $HOME/.local/share/systemd/user/${GARM_SERVICE_NAME}.service +fi + +if [ -d "$GARM_CONFIG_DIR" ] && [ -f "$GARM_CONFIG_DIR/config.toml" ] && [ -f "$GARM_CONFIG_DIR/garm-provider-lxd.toml" ];then + rm -rf ${GARM_CONFIG_DIR} +fi \ No newline at end of file