summaryrefslogtreecommitdiff
path: root/neozip/arch/s390/self-hosted-builder/actions-runner-rebuild.sh
diff options
context:
space:
mode:
Diffstat (limited to 'neozip/arch/s390/self-hosted-builder/actions-runner-rebuild.sh')
-rw-r--r--neozip/arch/s390/self-hosted-builder/actions-runner-rebuild.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/neozip/arch/s390/self-hosted-builder/actions-runner-rebuild.sh b/neozip/arch/s390/self-hosted-builder/actions-runner-rebuild.sh
new file mode 100644
index 0000000000..7fded31785
--- /dev/null
+++ b/neozip/arch/s390/self-hosted-builder/actions-runner-rebuild.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/bash
+set -ex
+
+TMPDIR="$(mktemp -d)"
+
+if [ -f actions-runner.Dockerfile ]; then
+ MODE=1
+ cp actions-runner.Dockerfile actions-runner entrypoint $TMPDIR
+ cd $TMPDIR
+else
+ MODE=2
+ cd $TMPDIR
+ wget https://raw.githubusercontent.com/zlib-ng/zlib-ng/refs/heads/develop/arch/s390/self-hosted-builder/actions-runner.Dockerfile
+ wget https://raw.githubusercontent.com/zlib-ng/zlib-ng/refs/heads/develop/arch/s390/self-hosted-builder/actions-runner
+ wget https://raw.githubusercontent.com/zlib-ng/zlib-ng/refs/heads/develop/arch/s390/self-hosted-builder/entrypoint
+fi
+
+# Stop service
+systemctl stop actions-runner || true
+
+# Delete old container
+podman container rm gaplib-actions-runner || true
+
+# Delete old image
+podman image rm localhost/zlib-ng/actions-runner || true
+
+# Prune all unused podman data
+podman system prune -f || true
+
+# Build new image
+podman build --squash -f actions-runner.Dockerfile --tag zlib-ng/actions-runner . 2>&1 | tee /var/log/actions-runner-build.log
+
+# Create new container
+podman create --replace --name=gaplib-actions-runner --env-file=/etc/actions-runner --init \
+ zlib-ng/actions-runner 2>&1 | tee -a /var/log/actions-runner-build.log
+
+# Start service
+systemctl start actions-runner || true
+
+# Cleanup
+podman image prune -af || true
+
+# Clean up tempfile
+if [ "$MODE" == "2" ] ; then
+ cd $TMPDIR
+ rm actions-runner.Dockerfile
+ rm actions-runner
+ rm entrypoint
+ cd ..
+ rmdir $TMPDIR
+ echo "Deleted tempfiles."
+fi