mirror of
				https://github.com/casjaysdevdocker/gitea
				synced 2025-11-04 07:02:12 -05:00 
			
		
		
		
	🗃️ Committing everything that changed 🗃️
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				release-tag / release-image (push) Successful in 10m51s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	release-tag / release-image (push) Successful in 10m51s
				
			rootfs/usr/local/bin/start-runners rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh
This commit is contained in:
		@@ -52,19 +52,20 @@ __start_runner() {
 | 
			
		||||
 | 
			
		||||
	# Create runner directory
 | 
			
		||||
	mkdir -p "$runner_dir"
 | 
			
		||||
	cd "$runner_dir"
 | 
			
		||||
	__log "Starting runner: $runner_name (ID: $runner_id)"
 | 
			
		||||
	# Register the runner (this creates the .runner file)
 | 
			
		||||
	__log "Registering runner: $runner_name"
 | 
			
		||||
	act_runner register --instance "$SERVER_ADDRESS" --token "$SERVER_TOKEN" --name "$runner_name" --labels "$RUNNER_LABELS" --no-interactive
 | 
			
		||||
 | 
			
		||||
	if [ $? -ne 0 ]; then
 | 
			
		||||
		__log "ERROR: Failed to register runner $runner_name"
 | 
			
		||||
		return 1
 | 
			
		||||
	if [ ! -f "$runner_dir/.runner" ]; then
 | 
			
		||||
		__log "Registering runner: $runner_name (ID: $runner_id)"
 | 
			
		||||
		[ -d "$runner_dir" ] && cd "$runner_dir" || return 1
 | 
			
		||||
		# Register the runner (this creates the .runner file)
 | 
			
		||||
		act_runner register --instance "$SERVER_ADDRESS" --token "$SERVER_TOKEN" --name "$runner_name" --labels "$RUNNER_LABELS" --no-interactive
 | 
			
		||||
		if [ $? -ne 0 ]; then
 | 
			
		||||
			__log "ERROR: Failed to register runner $runner_name"
 | 
			
		||||
			return 1
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
	# Start the daemon
 | 
			
		||||
	__log "Starting daemon for runner: $runner_name"
 | 
			
		||||
	exec act_runner daemon --config .runner
 | 
			
		||||
	exec act_runner daemon --config "$runner_dir/.runner"
 | 
			
		||||
}
 | 
			
		||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
			
		||||
# Start runners in background
 | 
			
		||||
 
 | 
			
		||||
@@ -240,37 +240,6 @@ __run_pre_execute_checks() {
 | 
			
		||||
		[ -d "$DATA_DIR/cache" ] || mkdir -p "$DATA_DIR/cache"
 | 
			
		||||
		[ -d "$CONF_DIR/tokens" ] || mkdir -p "$CONF_DIR/tokens"
 | 
			
		||||
		if [ -f "$RUNNER_CONFIG_DEFAULT" ]; then
 | 
			
		||||
			if [ ! -f "$CONF_DIR/reg/default.sample" ]; then
 | 
			
		||||
				echo "A sample registration file can be found in: $CONF_DIR/reg/default.sample" >/dev/stdout
 | 
			
		||||
				cat <<EOF >"$CONF_DIR/reg/default.sample"
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
# Edit this file and execute it
 | 
			
		||||
exitStatus=1
 | 
			
		||||
RUNNER_HOME="\$HOME/.config/act_runner"
 | 
			
		||||
RUNNER_NAME="\$(hostname -f|sed 's|[.]|_|g')"
 | 
			
		||||
RUNNER_REGISTER_URL="https://$INSTANCE_HOSTNAME"
 | 
			
		||||
RUNNER_AUTH_TOKEN="${RUNNER_AUTH_TOKEN:-$SYS_AUTH_TOKEN}"
 | 
			
		||||
RUNNER_LABELS="$RUNNER_LABELS"
 | 
			
		||||
ACT_API_URL="\$(curl -q -LSsf -X 'GET' 'https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest' -H 'accept: application/json' | jq '.[]' | jq -rc '.[].browser_download_url' 2>/dev/null)"
 | 
			
		||||
echo "Installing act_runner"
 | 
			
		||||
mkdir -p "\$RUNNER_HOME"
 | 
			
		||||
case "\$(uname -m)" in x86_64) ACT_API_URL="\$(echo "\$ACT_API_URL" | grep 'linux.*amd64$')" ;; aarch64) ACT_API_URL="(echo "\$ACT_API_URL"|grep 'linux.*aarch64$')" ;; *) echo "\$(uname -m) is not supported by this script" >&2 && exit 1 ;; esac
 | 
			
		||||
if [ -n "\$ACT_API_URL" ]; then
 | 
			
		||||
  [ -n "\$(type -P act_runner)" ] || curl -q -LSsf "\$ACT_API_URL" -o "/usr/local/bin/act_runner" && chmod -Rf 755 "/usr/local/bin/act_runner" 
 | 
			
		||||
  [ -n "\$(type -P act_runner)" ] || { echo "Failed to download act_runner from: \$ACT_API_URL" && exit 1; }
 | 
			
		||||
  [ -f "\$RUNNER_HOME/config.yaml" ] || act_runner generate-config >"\$RUNNER_HOME/config.yaml"
 | 
			
		||||
  act_runner register --config "\$RUNNER_HOME/config.yaml" --labels "\$RUNNER_LABELS" --name "\$RUNNER_NAME" --instance "\$RUNNER_REGISTER_URL" --token "\$RUNNER_AUTH_TOKEN" --no-interactive && exitStatus=0
 | 
			
		||||
  if [ "\$exitStatus" -eq 0 ]; then
 | 
			
		||||
    echo "Act runner has been registered with server: \$RUNNER_REGISTER_URL"
 | 
			
		||||
    act_runner daemon --config "\$RUNNER_HOME/config.yaml" &
 | 
			
		||||
    exitStatus=\$?
 | 
			
		||||
  fi
 | 
			
		||||
fi
 | 
			
		||||
exit \$exitStatus 
 | 
			
		||||
 | 
			
		||||
EOF
 | 
			
		||||
			fi
 | 
			
		||||
			#
 | 
			
		||||
			mkdir -p "$RUNNER_DEFAULT_HOME" "$TMP_DIR/runners/gitea"
 | 
			
		||||
			[ -f "$RUNNER_DEFAULT_HOME/$RUNNER_CONFIG_NAME" ] || copy "$RUNNER_CONFIG_DEFAULT" "$RUNNER_DEFAULT_HOME/$RUNNER_CONFIG_NAME"
 | 
			
		||||
			if [ ! -f "$RUNNER_DEFAULT_HOME/runners" ] && [ -n "$SYS_AUTH_TOKEN" ] && [ -f "$RUNNER_DEFAULT_HOME/$RUNNER_CONFIG_NAME" ]; then
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user