diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a93556b1ea..4a6b6436fc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -100,6 +100,8 @@ build:
- touch ${BUILD_DIR}/prebuilt
- mkdir -p ${OUTPUT_DIR}
- shopt -s dotglob && mv ${BUILD_DIR}/* ${OUTPUT_DIR}
+ after_script:
+ - sudo chown -R comma:comma ${OUTPUT_DIR}
artifacts:
paths:
- ${OUTPUT_DIR}/
diff --git a/.idea/customTargets.xml b/.idea/customTargets.xml
new file mode 100644
index 0000000000..457f9942d0
--- /dev/null
+++ b/.idea/customTargets.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.run/Build Debug.run.xml b/.run/Build Debug.run.xml
new file mode 100644
index 0000000000..a7b47c9011
--- /dev/null
+++ b/.run/Build Debug.run.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.run/Build Release.run.xml b/.run/Build Release.run.xml
new file mode 100644
index 0000000000..cbf6343e87
--- /dev/null
+++ b/.run/Build Release.run.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/release/ci/install_gitlab_runner.sh b/release/ci/install_gitlab_runner.sh
index c8bac10c39..a44c13cc92 100755
--- a/release/ci/install_gitlab_runner.sh
+++ b/release/ci/install_gitlab_runner.sh
@@ -1,80 +1,106 @@
#!/bin/bash
+set -e
-# We need RW for the install process
-sudo mount -o remount rw /
+# Check if script arguments are present, if not exit the script
+if [ $# -eq 0 ]; then
+ echo "No arguments provided. A GitLab token is required to run this script."
+ exit 1
+fi
-# Ensure filesystem is remounted as read-only on script exit
-trap "sudo mount -o remount ro /" EXIT
+# Constants
+GITLAB_RUNNER_DOWNLOAD_URL="https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-arm64"
+GITLAB_RUNNER_USER_NAME="gitlab-runner"
+USER_GROUPS="comma,gpu,gpio,sudo"
+GITLAB_BASE_DIR="/data/gitlab"
+GITLAB_BIN_DIR="${GITLAB_BASE_DIR}/bin"
+GITLAB_BUILDS_DIR="${GITLAB_BASE_DIR}/builds"
+GITLAB_LOGS_DIR="${GITLAB_BASE_DIR}/logs"
+GITLAB_CACHE_DIR="${GITLAB_BASE_DIR}/cache"
+GITLAB_OPENPILOT_DIR="${GITLAB_BASE_DIR}/openpilot"
+SERVICE_NAME="gitlab-runner"
-# Define directories
-BASE_DIR="/data/gitlab"
-BIN_DIR="$BASE_DIR/bin"
-CONFIG_DIR="$BASE_DIR"
-BUILDS_DIR="$BASE_DIR/builds"
-OPENPILOT_DIR="$BASE_DIR/openpilot"
-LOGS_DIR="$BASE_DIR/logs"
-CACHE_DIR="$BASE_DIR/cache"
-GITLAB_RUNNER_USERNAME="gitlab-runner"
-GROUPS_NEEDED="comma,gpu,gpio"
+create_gitlab_runner_directories() {
+ sudo mkdir -p "$GITLAB_BIN_DIR" "$GITLAB_BUILDS_DIR" "$GITLAB_LOGS_DIR" "$GITLAB_CACHE_DIR" "$GITLAB_OPENPILOT_DIR"
+ mkdir -p "/data/openpilot"
+ sudo chown -R comma:comma "/data/openpilot"
+}
-# Create necessary directories
-sudo mkdir -p "$BIN_DIR" "$BUILDS_DIR" "$LOGS_DIR" "$CACHE_DIR" "$OPENPILOT_DIR"
+download_and_setup_gitlab_runner() {
+ sudo curl -L --output "$GITLAB_BIN_DIR/gitlab-runner" "$GITLAB_RUNNER_DOWNLOAD_URL"
+ sudo chmod +x "$GITLAB_BIN_DIR/gitlab-runner"
+}
-# Download the GitLab Runner binary
-sudo curl -L --output "$BIN_DIR/gitlab-runner" "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-arm64"
+setup_gitlab_runner_user() {
+ sudo useradd --comment 'GitLab Runner' --create-home --home-dir ${GITLAB_BASE_DIR} ${GITLAB_RUNNER_USER_NAME} --shell /bin/bash -G ${USER_GROUPS} || sudo usermod -aG ${USER_GROUPS} ${GITLAB_RUNNER_USER_NAME}
+ export GITLAB_BASE_DIR # Export it to make it available to sub-processes
+ sudo -u ${GITLAB_RUNNER_USER_NAME} bash -c "truncate -s 0 '${GITLAB_BASE_DIR}/.bash_logout'"
+}
-# Give it permission to execute
-sudo chmod +x "$BIN_DIR/gitlab-runner"
+create_sudoers_entry() {
+ sudo grep -qxF "${GITLAB_RUNNER_USER_NAME} ALL=(ALL) NOPASSWD: ALL" /etc/sudoers || echo "${GITLAB_RUNNER_USER_NAME} ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
+}
-# Create a GitLab Runner user
-sudo useradd --comment 'GitLab Runner' --create-home --home-dir ${BASE_DIR} ${GITLAB_RUNNER_USERNAME} --shell /bin/bash -G ${GROUPS_NEEDED} || sudo usermod -aG ${GROUPS_NEEDED} gitlab-runner
-
-# Clean bash_logout as it break gitlab pipelines
-sudo truncate -s 0 ${BASE_DIR}/.bash_logout
-
-# Create a configuration file
-cat <