From 2145face42f81888fd651bf53df012489f56a31a Mon Sep 17 00:00:00 2001 From: Cyra Date: Sun, 29 Mar 2026 17:25:13 -0700 Subject: [PATCH 1/9] fix(forgejo-runner): support generated/unattended mode and configurable runner labels - Export app-specific variables (var_forgejo_instance, var_forgejo_runner_token, var_runner_labels) in ct script so they survive lxc-attach into the container - Replace nonexistent prompt_input_required/show_missing_values_warning calls with standard read prompts that skip when variables are pre-set - Add hard error when no runner token is provided - Make runner labels configurable via var_runner_labels instead of hardcoded - Update default runner image from node:20-bookworm to node:22-bookworm (Node 22 LTS) --- ct/forgejo-runner.sh | 6 +++++ install/forgejo-runner-install.sh | 41 +++++++++++++++++++------------ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/ct/forgejo-runner.sh b/ct/forgejo-runner.sh index 652085ff..93470d3c 100644 --- a/ct/forgejo-runner.sh +++ b/ct/forgejo-runner.sh @@ -18,6 +18,12 @@ var_unprivileged="${var_unprivileged:-1}" var_nesting="${var_nesting:-1}" var_keyctl="${var_keyctl:-1}" +# App-specific variables (not in build.func whitelist) +# Export so they survive lxc-attach into the container +export var_forgejo_instance="${var_forgejo_instance:-}" +export var_forgejo_runner_token="${var_forgejo_runner_token:-}" +export var_runner_labels="${var_runner_labels:-}" + header_info "$APP" variables color diff --git a/install/forgejo-runner-install.sh b/install/forgejo-runner-install.sh index 97968e75..1d2b9910 100644 --- a/install/forgejo-runner-install.sh +++ b/install/forgejo-runner-install.sh @@ -12,19 +12,31 @@ setting_up_container network_check update_os -# Get required configuration with sensible fallbacks for unattended mode -# These will show a warning if defaults are used -var_forgejo_instance=$(prompt_input_required \ - "Forgejo Instance URL:" \ - "${var_forgejo_instance:-https://codeberg.org}" \ - 120 \ - "var_forgejo_instance") +# Get required configuration — skip prompts if already set (generated/unattended mode) +if [[ -z "${var_forgejo_instance:-}" ]]; then + read -r -p "${TAB3}Forgejo Instance URL (e.g. https://codeberg.org): " var_forgejo_instance + var_forgejo_instance="${var_forgejo_instance:-https://codeberg.org}" +fi -var_forgejo_runner_token=$(prompt_input_required \ - "Forgejo Runner Registration Token:" \ - "${var_forgejo_runner_token:-REPLACE_WITH_YOUR_TOKEN}" \ - 120 \ - "var_forgejo_runner_token") +if [[ -z "${var_forgejo_runner_token:-}" ]]; then + read -r -p "${TAB3}Forgejo Runner Registration Token: " var_forgejo_runner_token +fi + +if [[ -z "${var_forgejo_runner_token:-}" ]]; then + msg_error "No runner registration token provided. Cannot continue." + exit 1 +fi + +# Runner labels — default is always included; additional labels are appended +DEFAULT_RUNNER_LABELS="linux-amd64:docker://node:22-bookworm" +if [[ -z "${var_runner_labels:-}" ]]; then + read -r -p "${TAB3}Additional runner labels (comma-separated, or leave blank for default only): " var_runner_labels +fi +if [[ -n "${var_runner_labels:-}" ]]; then + RUNNER_LABELS="${DEFAULT_RUNNER_LABELS},${var_runner_labels}" +else + RUNNER_LABELS="${DEFAULT_RUNNER_LABELS}" +fi export FORGEJO_INSTANCE="$var_forgejo_instance" export FORGEJO_RUNNER_TOKEN="$var_forgejo_runner_token" @@ -52,7 +64,7 @@ forgejo-runner register \ --instance "$FORGEJO_INSTANCE" \ --token "$FORGEJO_RUNNER_TOKEN" \ --name "$HOSTNAME" \ - --labels "linux-amd64:docker://node:20-bookworm" \ + --labels "$RUNNER_LABELS" \ --no-interactive msg_ok "Registered Forgejo Runner" @@ -79,9 +91,6 @@ EOF systemctl enable -q --now forgejo-runner msg_ok "Created Services" -# Show warning if any required values used fallbacks -show_missing_values_warning - motd_ssh customize cleanup_lxc From cb9782df2c0832ad91b2d125f983a46bd18561b8 Mon Sep 17 00:00:00 2001 From: Cyra Date: Sun, 29 Mar 2026 18:05:04 -0700 Subject: [PATCH 2/9] fix(forgejo-runner): use COMMUNITY_SCRIPTS_URL for build.func sourcing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CT script hardcoded the upstream URL for build.func, so the install script was always fetched from upstream — ignoring fork/branch fixes. Now respects COMMUNITY_SCRIPTS_URL override, consistent with how build.func already handles this for all other resource fetching. --- ct/forgejo-runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/forgejo-runner.sh b/ct/forgejo-runner.sh index 93470d3c..19aaabfe 100644 --- a/ct/forgejo-runner.sh +++ b/ct/forgejo-runner.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +source <(curl -fsSL "${COMMUNITY_SCRIPTS_URL:-https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main}/misc/build.func") # Copyright (c) 2021-2026 community-scripts ORG # Author: Simon Friedrich From 034a1967205dccb3a4fa8b3d5a069dc03cd95333 Mon Sep 17 00:00:00 2001 From: Cyra Date: Sun, 29 Mar 2026 18:22:13 -0700 Subject: [PATCH 3/9] fix(forgejo-runner): use hostname command instead of $HOSTNAME variable core.func overwrites $HOSTNAME with a formatted emoji string for display purposes, causing runner registration to send garbled ANSI codes as the runner name. Use $(hostname) to get the actual system hostname. --- install/forgejo-runner-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/forgejo-runner-install.sh b/install/forgejo-runner-install.sh index 1d2b9910..f8e7abc2 100644 --- a/install/forgejo-runner-install.sh +++ b/install/forgejo-runner-install.sh @@ -63,7 +63,7 @@ export DOCKER_HOST="unix:///run/podman/podman.sock" forgejo-runner register \ --instance "$FORGEJO_INSTANCE" \ --token "$FORGEJO_RUNNER_TOKEN" \ - --name "$HOSTNAME" \ + --name "$(hostname)" \ --labels "$RUNNER_LABELS" \ --no-interactive msg_ok "Registered Forgejo Runner" From e949ed75a7967498377effa31b96c52597c3af2c Mon Sep 17 00:00:00 2001 From: Cyra Date: Sun, 29 Mar 2026 18:25:30 -0700 Subject: [PATCH 4/9] fix(forgejo-runner): cd to /root before runner registration forgejo-runner register writes .runner config to the current working directory. The install script runs in a temp directory (via build.func), so the config was lost on cleanup. The systemd service expects it in /root (WorkingDirectory=/root), so cd there before registering. --- install/forgejo-runner-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install/forgejo-runner-install.sh b/install/forgejo-runner-install.sh index f8e7abc2..3b1c3abe 100644 --- a/install/forgejo-runner-install.sh +++ b/install/forgejo-runner-install.sh @@ -60,6 +60,7 @@ msg_ok "Installed Forgejo Runner" msg_info "Registering Forgejo Runner" export DOCKER_HOST="unix:///run/podman/podman.sock" +cd /root forgejo-runner register \ --instance "$FORGEJO_INSTANCE" \ --token "$FORGEJO_RUNNER_TOKEN" \ From fb95fe9457d4ca83a79ad562ed43d4bba463e5a1 Mon Sep 17 00:00:00 2001 From: Cyra Date: Sun, 29 Mar 2026 19:30:19 -0700 Subject: [PATCH 5/9] fix(forgejo-runner): fail early when token missing in unattended mode Abort before build_container if mode is set (unattended) but no runner registration token was provided. Avoids a 20+ minute container build only to fail at the registration step. --- ct/forgejo-runner.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ct/forgejo-runner.sh b/ct/forgejo-runner.sh index 19aaabfe..0c0fd8aa 100644 --- a/ct/forgejo-runner.sh +++ b/ct/forgejo-runner.sh @@ -62,6 +62,12 @@ function update_script() { exit } +# Fail early if running unattended without a runner token +if [[ -n "${mode:-}" && -z "${var_forgejo_runner_token:-}" ]]; then + msg_error "var_forgejo_runner_token is required for unattended installs." + exit 1 +fi + start build_container description From 82ea3f24f1efed15902577c1c137a127285a93eb Mon Sep 17 00:00:00 2001 From: Cyra Date: Sun, 29 Mar 2026 19:30:46 -0700 Subject: [PATCH 6/9] fix(forgejo-runner): also require forgejo instance URL in unattended mode --- ct/forgejo-runner.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ct/forgejo-runner.sh b/ct/forgejo-runner.sh index 0c0fd8aa..06f2b3f4 100644 --- a/ct/forgejo-runner.sh +++ b/ct/forgejo-runner.sh @@ -62,10 +62,16 @@ function update_script() { exit } -# Fail early if running unattended without a runner token -if [[ -n "${mode:-}" && -z "${var_forgejo_runner_token:-}" ]]; then - msg_error "var_forgejo_runner_token is required for unattended installs." - exit 1 +# Fail early if running unattended without required values +if [[ -n "${mode:-}" ]]; then + if [[ -z "${var_forgejo_instance:-}" ]]; then + msg_error "var_forgejo_instance is required for unattended installs." + exit 1 + fi + if [[ -z "${var_forgejo_runner_token:-}" ]]; then + msg_error "var_forgejo_runner_token is required for unattended installs." + exit 1 + fi fi start From 237c0b7f026edfde9e44a187b58be55bdfae8790 Mon Sep 17 00:00:00 2001 From: Cyra Date: Sun, 29 Mar 2026 19:32:09 -0700 Subject: [PATCH 7/9] fix(forgejo-runner): only validate required vars when truly non-interactive Check for missing token/URL only when mode is set AND there's no TTY, so mode=default with a terminal still allows interactive prompts inside the container. --- ct/forgejo-runner.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ct/forgejo-runner.sh b/ct/forgejo-runner.sh index 06f2b3f4..85faf97c 100644 --- a/ct/forgejo-runner.sh +++ b/ct/forgejo-runner.sh @@ -63,7 +63,8 @@ function update_script() { } # Fail early if running unattended without required values -if [[ -n "${mode:-}" ]]; then +# Only check when there's no TTY (truly non-interactive, e.g. piped or scripted) +if [[ -n "${mode:-}" && ! -t 0 ]]; then if [[ -z "${var_forgejo_instance:-}" ]]; then msg_error "var_forgejo_instance is required for unattended installs." exit 1 From 17b2229bceb6945074df1cdedec445554cbc44c3 Mon Sep 17 00:00:00 2001 From: Cyra Date: Sun, 29 Mar 2026 19:33:17 -0700 Subject: [PATCH 8/9] fix(forgejo-runner): revert TTY check, gate on mode being explicitly set mode is only set when the user is automating (e.g. mode=default with var_* overrides). The default bash -c curl invocation leaves mode empty and shows the whiptail menu, so this check won't affect interactive use. --- ct/forgejo-runner.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ct/forgejo-runner.sh b/ct/forgejo-runner.sh index 85faf97c..77e02fe2 100644 --- a/ct/forgejo-runner.sh +++ b/ct/forgejo-runner.sh @@ -63,8 +63,9 @@ function update_script() { } # Fail early if running unattended without required values -# Only check when there's no TTY (truly non-interactive, e.g. piped or scripted) -if [[ -n "${mode:-}" && ! -t 0 ]]; then +# mode is only set when the user explicitly passes it (automating); +# bare "bash -c $(curl ...)" leaves mode empty and shows the whiptail menu +if [[ -n "${mode:-}" ]]; then if [[ -z "${var_forgejo_instance:-}" ]]; then msg_error "var_forgejo_instance is required for unattended installs." exit 1 From 72b1a6460b7f8de1349ec381b43161f0fa1f2c79 Mon Sep 17 00:00:00 2001 From: Cyra Date: Wed, 29 Apr 2026 12:01:55 -0700 Subject: [PATCH 9/9] fix(forgejo-runner): revert COMMUNITY_SCRIPTS_URL override per review Drop the env-var indirection on the build.func source URL; it was a dev convenience for testing against a fork and adds no user-facing value. --- ct/forgejo-runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/forgejo-runner.sh b/ct/forgejo-runner.sh index 77e02fe2..d8a5bf99 100644 --- a/ct/forgejo-runner.sh +++ b/ct/forgejo-runner.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL "${COMMUNITY_SCRIPTS_URL:-https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main}/misc/build.func") +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) # Copyright (c) 2021-2026 community-scripts ORG # Author: Simon Friedrich