-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.sh
More file actions
executable file
·33 lines (27 loc) · 1.04 KB
/
config.sh
File metadata and controls
executable file
·33 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -eoux pipefail
CONTAINER_NAME="osiris-hardware-ci"
RUNNER_DIR="$(pwd)/runner"
IMAGE="ghcr.io/osirisrtos/hardware-ci:latest"
mkdir -p "${RUNNER_DIR}"
touch "${RUNNER_DIR}/.env" "${RUNNER_DIR}/.path"
chmod 644 "${RUNNER_DIR}/.env" "${RUNNER_DIR}/.path"
podman pull "${IMAGE}" || true
# If a running container with the same name exists, stop it.
if podman ps -q -f name="^${CONTAINER_NAME}$" | grep -q .; then
echo "Stopping running container ${CONTAINER_NAME}..."
podman stop "${CONTAINER_NAME}" || true
fi
# If there's any container with the same name, remove it.
if podman ps -aq -f name="^${CONTAINER_NAME}$" | grep -q .; then
echo "Removing existing container ${CONTAINER_NAME}..."
podman rm "${CONTAINER_NAME}" || true
fi
podman run --name "${CONTAINER_NAME}" -d \
--pull always \
--env-file "$(pwd)/.env" \
-v "$(pwd)/chips.yml:/home/runner/actions-runner/chips.yml:ro" \
-v "${RUNNER_DIR}/.path:/home/runner/actions-runner/.path:Z" \
--device /dev/bus/usb --restart unless-stopped \
"${IMAGE}" \
"$@"