Without using config seems to work as well.
This commit is contained in:
@@ -8,4 +8,5 @@ ADDITIONAL_LABLES=(
|
|||||||
)
|
)
|
||||||
CONTAINER_HOST="unix:////run/user/1000/podman/podman.sock"
|
CONTAINER_HOST="unix:////run/user/1000/podman/podman.sock"
|
||||||
GITEA_URL="https://gitea.example.com"
|
GITEA_URL="https://gitea.example.com"
|
||||||
GITEA_TOKEN="your_gitea_token"
|
GITEA_TOKEN=" <your_gitea_token>"
|
||||||
|
RUNNER_NAME="gitea-runner"
|
||||||
@@ -32,20 +32,40 @@ wget -q "$DOWNLOAD_URL" -O "$RUNNER" || {
|
|||||||
chmod +x "$INSTALL_DIR/act_runner"
|
chmod +x "$INSTALL_DIR/act_runner"
|
||||||
echo "act_runner downloaded and made executable."
|
echo "act_runner downloaded and made executable."
|
||||||
|
|
||||||
$RUNNER generate-config > "$INSTALL_DIR/config.yaml"
|
DEFAULT_LABELS=(
|
||||||
|
"ubuntu-latest:docker://gitea/runner-images:ubuntu-latest"
|
||||||
|
"ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04"
|
||||||
|
"ubuntu-20.04:docker://gitea/runner-images:ubuntu-20.04"
|
||||||
|
)
|
||||||
|
|
||||||
echo "act_runner config generated."
|
LABELS=("${DEFAULT_LABELS[@]}" "${ADDITIONAL_LABLES[@]}")
|
||||||
echo "act_runner config file created at $INSTALL_DIR/config.yaml"
|
|
||||||
|
|
||||||
echo "manually add additional labels to the config file - $INSTALL_DIR/config.yaml"
|
LABLES_STRING=$(IFS=','; echo "${LABELS[*]}")
|
||||||
echo "add the following labels to the config file - $INSTALL_DIR/config.yaml"
|
|
||||||
for label in "${ADDITIONAL_LABLES[@]}"; do
|
|
||||||
echo " - $label"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "manually add docker socket to the config file - $INSTALL_DIR/config.yaml"
|
pushd "$INSTALL_DIR" || exit 1
|
||||||
echo "add the following docker socket to the config file - $INSTALL_DIR/config.yaml"
|
$RUNNER register \
|
||||||
echo " - $CONTAINER_HOST"
|
--no-interactive \
|
||||||
|
--instance $GITEA_URL \
|
||||||
|
--token $GITEA_TOKEN \
|
||||||
|
--name $RUNNER_NAME \
|
||||||
|
--labels $LABLES_STRING
|
||||||
|
|
||||||
|
popd || exit 1
|
||||||
|
|
||||||
|
# $RUNNER generate-config > "$INSTALL_DIR/config.yaml"
|
||||||
|
|
||||||
|
# echo "act_runner config generated."
|
||||||
|
# echo "act_runner config file created at $INSTALL_DIR/config.yaml"
|
||||||
|
|
||||||
|
# echo "manually add additional labels to the config file - $INSTALL_DIR/config.yaml"
|
||||||
|
# echo "add the following labels to the config file - $INSTALL_DIR/config.yaml"
|
||||||
|
# for label in "${ADDITIONAL_LABLES[@]}"; do
|
||||||
|
# echo " - $label"
|
||||||
|
# done
|
||||||
|
|
||||||
|
# echo "manually add docker socket to the config file - $INSTALL_DIR/config.yaml"
|
||||||
|
# echo "add the following docker socket to the config file - $INSTALL_DIR/config.yaml"
|
||||||
|
# echo " - $CONTAINER_HOST"
|
||||||
|
|
||||||
# Create systemd service file
|
# Create systemd service file
|
||||||
SERVICE_FILE="${SERVICE_NAME}.service"
|
SERVICE_FILE="${SERVICE_NAME}.service"
|
||||||
@@ -54,13 +74,11 @@ cp "$SERVICE_FILE.template" "$SERVICE_FILE"
|
|||||||
ESC_RUNNER=$(printf '%s' "$RUNNER" | sed 's:/:\\/:g')
|
ESC_RUNNER=$(printf '%s' "$RUNNER" | sed 's:/:\\/:g')
|
||||||
ESC_INSTALL_DIR=$(printf '%s' "$INSTALL_DIR" | sed 's:/:\\/:g')
|
ESC_INSTALL_DIR=$(printf '%s' "$INSTALL_DIR" | sed 's:/:\\/:g')
|
||||||
|
|
||||||
sed -i "s|^ExecStart=.*$|ExecStart=${ESC_RUNNER} daemon --config ${ESC_INSTALL_DIR}/config.yaml|" "$SERVICE_FILE"
|
sed -i "s|^ExecStart=.*$|ExecStart=${ESC_RUNNER} daemon|" "$SERVICE_FILE"
|
||||||
sed -i "s|^WorkingDirectory=.*$|WorkingDirectory=${ESC_INSTALL_DIR}|" "$SERVICE_FILE"
|
sed -i "s|^WorkingDirectory=.*$|WorkingDirectory=${ESC_INSTALL_DIR}|" "$SERVICE_FILE"
|
||||||
|
|
||||||
mv "$SERVICE_FILE" "$USER_SYSTEMD/$SERVICE_FILE"
|
mv "$SERVICE_FILE" "$USER_SYSTEMD/$SERVICE_FILE"
|
||||||
systemctl --user daemon-reload
|
systemctl --user daemon-reload
|
||||||
systemctl --user enable "${SERVICE_NAME}.service"
|
systemctl --user enable --now "${SERVICE_NAME}.service"
|
||||||
|
|
||||||
echo "Gitea act_runner installed and systemd service created."
|
echo "Gitea act_runner installed and systemd service created."
|
||||||
echo "Before starting the service, please edit the config file - $INSTALL_DIR/config.yaml"
|
|
||||||
echo "and register the runner with your Gitea instance."
|
|
||||||
Reference in New Issue
Block a user