mirror of https://github.com/rusefi/rusefi-ci.git
update scripts
This commit is contained in:
parent
b752767c8f
commit
203068689d
|
@ -1,11 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "--------------------------------------------------------------"
|
echo "--------------------------------------------------------------"
|
||||||
echo "Step 1/5, OS setup"
|
echo "Step 1/5, OS setup"
|
||||||
|
|
||||||
source scripts/01_setup_OS.sh || { exit 1; }
|
source scripts/01_setup_OS.sh || { exit 1; }
|
||||||
echo "--------------------------------------------------------------"
|
|
||||||
|
|
||||||
|
echo "--------------------------------------------------------------"
|
||||||
echo "Step 2/5, pulling/creating base runner container"
|
echo "Step 2/5, pulling/creating base runner container"
|
||||||
|
|
||||||
source scripts/02_setup_runner_container.sh || { exit 1; }
|
source scripts/02_setup_runner_container.sh || { exit 1; }
|
||||||
|
|
||||||
echo "--------------------------------------------------------------"
|
echo "--------------------------------------------------------------"
|
||||||
|
echo "Step 3/5, updating udev rules"
|
||||||
|
source scripts/03_setup_udev_rules.sh || { exit 1; }
|
||||||
|
|
||||||
|
echo "--------------------------------------------------------------"
|
||||||
|
echo "Step 4/5, select rusefi board for the runner"
|
||||||
|
source scripts/04_clone_rusefi_board_definitions.sh || { exit 1; }
|
||||||
|
|
||||||
|
echo "--------------------------------------------------------------"
|
||||||
|
echo "Step 5/5, create the runner"
|
||||||
|
source scripts/05_create_new_runner.sh || { exit 1; }
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
docker pull ghcr.io/fdsoftware/rusefi-ci
|
if docker pull ghcr.io/fdsoftware/rusefi-ci:main; then
|
||||||
# should build the image locally if the pull fails?
|
echo "remote docker container pull succeeded"
|
||||||
#docker build --build-arg GID=$(getent group docker | cut -d ':' -f 3) -t rusefi-ci .
|
else
|
||||||
|
echo "remote docker container pull failed, building image locally"
|
||||||
|
docker build --build-arg GID=$(getent group docker | cut -d ':' -f 3) -t rusefi-ci:main .
|
||||||
|
fi
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -e "/etc/udev/rules.d/70-rusefi.rules" ]; then
|
||||||
|
echo "creating udev rules"
|
||||||
|
cat >/etc/udev/rules.d/70-rusefi.rules <<EOL
|
||||||
|
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", GROUP="docker"
|
||||||
|
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", GROUP="docker"
|
||||||
|
EOL
|
||||||
|
sudo service udev restart
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "skipping, udev rules already installed"
|
||||||
|
|
||||||
|
fi
|
|
@ -41,5 +41,4 @@ done
|
||||||
# https://stackoverflow.com/questions/19661267/replace-spaces-with-underscores-via-bash
|
# https://stackoverflow.com/questions/19661267/replace-spaces-with-underscores-via-bash
|
||||||
OPT="${OPT// /-}"
|
OPT="${OPT// /-}"
|
||||||
|
|
||||||
# TODO: pass to 04 script
|
export RUNNER_NAME="hw-ci-$OPT"
|
||||||
echo "hw-ci-$OPT"
|
|
|
@ -1,33 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
NAME="runner-$1"
|
|
||||||
LABEL=${2:-"ubuntu-latest"}
|
|
||||||
IMAGE_HASH=$(docker image inspect rusefi-ci --format "{{.Id}}" 2>/dev/null)
|
|
||||||
|
|
||||||
|
|
||||||
# antes de crear el runner falta:
|
|
||||||
# reglas udev en caso de ser necesario
|
|
||||||
# probar conexion con STLink
|
|
||||||
# probar conexion con pcb de rusefi
|
|
||||||
|
|
||||||
|
|
||||||
if CONTAINER_HASH=$(docker container inspect $NAME --format "{{.Image}}" 2>/dev/null) && [ "$IMAGE_HASH" = "$CONTAINER_HASH" ]; then
|
|
||||||
echo "There is already a runner with the same configuration, skipping"
|
|
||||||
docker start -i "$NAME"
|
|
||||||
else
|
|
||||||
if docker container inspect "$NAME" >/dev/null 2>/dev/null; then
|
|
||||||
echo "existing runner but there is a more recent base image, recreating"
|
|
||||||
docker rm "$NAME"
|
|
||||||
fi
|
|
||||||
if [ -n "$3" ]; then
|
|
||||||
MOUNT="-v $PWD/$3:/opt/actions-runner/rusefi-env:ro"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#TODO: remove references to personal repo
|
|
||||||
docker run --name $NAME --detach --privileged --restart=unless-stopped $MOUNT \
|
|
||||||
-e RUNNER_NAME="$NAME" \
|
|
||||||
-e RUNNER_LABELS="$LABEL" \
|
|
||||||
-e RUNNER_TOKEN="$RUNNER_TOKEN" \
|
|
||||||
-e RUNNER_REPOSITORY_URL=https://github.com/FDSoftware/rusefi \
|
|
||||||
rusefi-ci
|
|
||||||
fi
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
LABEL=${2:-"ubuntu-latest"}
|
||||||
|
IMAGE_HASH=$(docker image inspect rusefi-ci --format "{{.Id}}" 2>/dev/null)
|
||||||
|
|
||||||
|
read -p "Enter the rusEFI board serial ID: " HARDWARE_CI_SERIAL
|
||||||
|
read -p "Enter the STLink ID: " HARDWARE_CI_STLINK_SERIAL
|
||||||
|
read -p "Enter the CI VBATT: " HARDWARE_CI_VBATT
|
||||||
|
|
||||||
|
echo "go to: https://github.com/FDSoftware/rusefi/settings/actions/runners/new and get a new runner token"
|
||||||
|
read -p "Enter your runner token: " RUNNER_TOKEN
|
||||||
|
|
||||||
|
DOCKER_RUNNER_IMAGE=$(docker images | grep -ioh "\S*rusefi-ci\S*" | head -1)
|
||||||
|
|
||||||
|
if CONTAINER_HASH=$(docker container inspect $RUNNER_NAME --format "{{.Image}}" 2>/dev/null) && [ "$IMAGE_HASH" = "$CONTAINER_HASH" ]; then
|
||||||
|
echo "There is already a runner with the same configuration, skipping"
|
||||||
|
docker start -i "$RUNNER_NAME"
|
||||||
|
else
|
||||||
|
if docker container inspect "$RUNNER_NAME" >/dev/null 2>/dev/null; then
|
||||||
|
echo "existing runner but there is a more recent base image, recreating"
|
||||||
|
docker rm "$RUNNER_NAME"
|
||||||
|
fi
|
||||||
|
if [ -n "$3" ]; then
|
||||||
|
MOUNT="-v $PWD/$3:/opt/actions-runner/rusefi-env:ro"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#TODO: remove references to personal repo
|
||||||
|
docker run --name $RUNNER_NAME --detach --privileged --restart=unless-stopped $MOUNT \
|
||||||
|
-e RUNNER_NAME="$RUNNER_NAME" \
|
||||||
|
-e RUNNER_LABELS="$LABEL" \
|
||||||
|
-e RUNNER_TOKEN="$RUNNER_TOKEN" \
|
||||||
|
-e HARDWARE_CI_SERIAL="$HARDWARE_CI_SERIAL" \
|
||||||
|
-e HARDWARE_CI_STLINK_SERIAL="$HARDWARE_CI_STLINK_SERIAL" \
|
||||||
|
-e HARDWARE_CI_VBATT="$HARDWARE_CI_VBATT" \
|
||||||
|
-e RUNNER_REPOSITORY_URL=https://github.com/FDSoftware/rusefi \
|
||||||
|
"$DOCKER_RUNNER_IMAGE:main"
|
||||||
|
fi
|
Loading…
Reference in New Issue